NHibernate.Linq -> The method CompareTo is not implemented
Here's the problem: in short I use comb.guid identity strategy and I need all the rows made after the saved marker..
Here's dummy code example of what I am trying to get:
return session.Linq .Where(p => p.Id.CompareTo(lastSyncedEntityIdentity) == 1 ) .ToList();
This throws an exception saying that CompareTo is not implemented...
System.NotImplementedException occurred
Message=The method CompareTo is not implemented.
Source=NHibernate.Linq
StackTrace:
at NHibernate.Linq.Visitors.RootVisitor.VisitMethodCall(MethodCallExpression expr) in e:\horn\.horn\orm\nhcontrib\nhibernate.linq\Working-2.1\src\NHibernate.Linq\Visitors\RootVisitor.cs:line 97
InnerException:
As you can see from stack I have tried the 2.1 version from hornget trunk without any help
Any hint/clue what I have to do in order to go around this limitation which I guess is impacting most of folks using comb.开发者_如何学Goguid strategy?
Thanks, Nikola
The issue here is that the method CompareTo cannot be translated into an SQL query.
Remember that all NHibernate.Linq is doing is building an SQL Select statement from the predicate defined in a lambda expression, anything used in the lambda must be translatable to a comparable SQL statement.
so
session.Linq.Where(p => p.Id == 10299);
can be translated to
SELECT * FROM Table WHERE Table.Id = 10299
however there is no SQL command for CompareTo as this is a .net method.
精彩评论