title: NHibernate 3.1 Query equals
body: <p>I just updated from NHibernate 2.1 to NHibernate 3.1. I found out that the equals operator for the use of Linq was not implemented for other types then string.<br>
  I found an <a href="http://www.primordialcode.com/blog/post/nhibernate-3-extending-linq-provider-fix-notsupportedexception" rel="nofollow">article</a> on the internet to solve this problem. This works fine for the basic types but now I want to compare a custom entities and I can't get it to work.</p>
  
  <p>I tried some implementations but none work:</p>
  
  <pre><code>ReflectionHelper.GetMethodDefinition&lt;CustomEntity&gt;(x =&gt; x.Equals(&lt;CustomEntity&gt;(0)))  
  ReflectionHelper.GetMethodDefinition&lt;CustomEntity&gt;(x =&gt; x.Equals(typeof(CustomEntity))
  </code></pre>
  
  <p>The query I want to execute is as follows:</p>
  
  <pre><code>Session.Query&lt;SomeEntity&gt;().Where(x =&gt; x.CustomEntity.Equals(CustomEntity);
  </code></pre>
  
  <p>How can I extend the equals to allow this and not get an NotSupportedException?</p>