daffini wrote:
gert wrote:
I do not have good ideas... Maybe someone else?
Gert
The only solution that i found is this..
http://cs.nerdbank.net/blogs/jmpinline/ ... 4/126.aspx But i have to implement a similar Equals method in all my business object...
I finally the solve the problem with a code like this :
public override bool Equals(object obj)
{
if (obj == this) return true;
obj = getImplementation(obj);
if (obj.GetType() != GetType() ) return false;
return Id.Equals(((GenericBO<IdT>) obj).Id);
}
protected object getImplementation(object obj)
{
if (obj is INHibernateProxy)
{
return NHibernateProxyHelper.GetLazyInitializer((INHibernateProxy) obj).GetImplementation();
}
else
{
return obj;
}
}
I've before tryed to use
public override bool Equals(object obj)
{
if (obj == this) return true;
NHibernate.NHibernateUtil.Initialize(obj);
if (obj.GetType() != GetType() ) return false;
return Id.Equals(((GenericBO<IdT>) obj).Id);
}
but it doesn't work...