NHibernate Equals和GetHashCode

NHibernate Equals和GetHashCode,nhibernate,Nhibernate,为什么在使用NHibernate时需要重写实体中的Equals和GetHash代码?今天我犯了这个错误 System.ApplicationException : For property 'Person' expected 'Domain.Person' of type 'Domain.Person' but got 'PersonProxy20252a6926f841a8b45e327292fe0eae' of type 'Domain.Person' 现在我已经读到(但没有确认)这是因为

为什么在使用NHibernate时需要重写实体中的Equals和GetHash代码?今天我犯了这个错误

System.ApplicationException : For property 'Person' expected 'Domain.Person'
of type 'Domain.Person' but got 'PersonProxy20252a6926f841a8b45e327292fe0eae'
of type 'Domain.Person'

现在我已经读到(但没有确认)这是因为我没有在我的实体中重写
Equals
GetHashCode
。我的问题是我是否需要这样做,我是否需要同时覆盖
Equals(objectobj)
Equals(Person-Person)
我假设我需要继承
IEquatable
并这样做。

确定完全不能覆盖Equals(Person-Person)对于IEquatable,事实上如果你这样做,它会中断确定完全不能覆盖Equals(Person-Person)对于IEquatable事实上,如果您这样做,它会中断

您可以发布完整异常吗?(使用堆栈跟踪和内部异常)您可以发布完整异常吗?(使用堆栈跟踪和内部异常)