3

I get this NHhiberante when verifying my Fluent Mappings

FluentNHibernate.Cfg.FluentConfigurationException : An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

----> NHibernate.InvalidProxyTypeException : The following types may not be used as proxies: Domain.Address: method Equals should be 'public/protected virtual' or 'protected internal virtual' Domain.Person: method Equals should be 'public/protected virtual' or 'protected internal virtual' TearDown : System.NullReferenceException : Object reference not set to an instance of an object.

I Tried making my Equals method virtual however I just end up getting this error

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

I am confused does anyone know what exactly is going on here?

Edit: It looks like you cant override : Equals(Person person) for IEquatable Not sure why this confuses NHibernate however?

1 Answer 1

4

As you mentioned in your edit, yes you can't implement IEqualityComparer<T> for an NHibernate entity class. Just override the simple public override bool Equals(object obj) and public override int GetHashCode().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.