I'm having some trouble where returning "this" is somehow returning a different reference/type when using castle proxies with nhibernate. Castle is 2.5.2.0 and NHibernate is 3.1.0.4000
public class Node
{
public int Id { get; set; }
public Node Me() { return this; }
}
public static void SomeMethod()
{
var node = session.Load<Node>(1)
var me = node.Me()
//ReferenceEquals(node, me) // false
//node == me // false
//node.GetType().Name // NodeProxy
//me.GetType().Name // Node
me.Id = 88;
// node.Id == 88 // true
}
This is an expected behavior. See my blog post, Hacking lazy loaded inheritance .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.