I just upgraded NHibernate 2.1 to NHibernate 3.1. I found out that the equals operator for using Linq was not implemented for other types, and then for the string.
I found an article on the Internet to solve this problem. This works great for basic types, but now I want to compare custom objects, and I can't get it to work.
I tried some implementations but no one worked:
ReflectionHelper.GetMethodDefinition<CustomEntity>(x => x.Equals(<CustomEntity>(0)))
ReflectionHelper.GetMethodDefinition<CustomEntity>(x => x.Equals(typeof(CustomEntity))
The query I want to execute is as follows:
Session.Query<SomeEntity>().Where(x => x.CustomEntity.Equals(CustomEntity);
How can I extend peers to allow this, and not get a NotSupportedException?
source
share