1
为什么我需要在使用NHibernate时在我的实体中覆盖Equals和GetHash代码?今天,我得到这个错误NHibernate等于和GetHashCode
System.ApplicationException : For property 'Person' expected 'Domain.Person'
of type 'Domain.Person' but got 'PersonProxy20252a6926f841a8b45e327292fe0eae'
of type 'Domain.Person'
现在我已经阅读(但未经证实),这是因为我在实体还没有被覆盖的Equals
和GetHashCode
。我的问题是我需要做到这一点,我是否需要覆盖Equals(Object obj)
和Equals(Person person)
我假设我需要继承IEquatable<Person>
并且这样做。
你可以发布完整的例外吗? (带有堆栈跟踪和内部例外) – 2010-08-16 17:29:31