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.