NHibernate Linq does not support `Object.Equals`

I am trying to run the following LINQ query, with NHibernate 4.0.4.4000:

user = await Task.Run(() => Session.Query<TUser>().Where(u => u.Id.Equals(id)).FirstOrDefault()).WithCurrentCulture(); 

and I get the following error:

 System.NotSupportedException: Boolean Equals(System.String) 

I cannot use == because Id is TKey typical parameter of type TKey , and C # does not allow me to do this. I looked at it, and NHibernate said it was fixed in NH3.0.0GA . Surely, in 4.0.4 it would not be detached again? Maybe because I run it in Task ? Is there a workaround other than ToList and then use Equals ?

0
c # linq nhibernate
source share

No one has answered this question yet.

See similar questions:

8
Foreach Loop Error

or similar:

1496
Multiple "order by" in LINQ
987
LINQ query in DataTable
939
Group in LINQ
798
What is the Java equivalent for LINQ?
789
When to use. First and when to use .FirstOrDefault with LINQ?
684
LINQ Aggregate Algorithm Explained
629
Dynamic LINQ OrderBy on IEnumerable <t> / IQueryable <t>
610
Using LINQ to remove items from a <T> list
4
NHibernate Queryable does not allow string comparisons
0
linq request async / wait