NHibernate 3.1: MissingMethodException when calling LambdaExtensions
Since upgrading from NH 3.0 to 3.1 I've been having some trouble using the following code:
criteria = session.CreateCriteria<User>()
.Add(SqlExpression.InG<User, int>(user => user.ID, toBeFechted)); // toBefetched is an IList<int>
This will compile fine but when running it I get an exception as soon as I add the In condition to the criteria.
System.MissingMethodException : Method not found: NHibernate.Criterion.AbstractCriterion NHibernate.Criterion.Restrictions.InG(System.String, System.Collections.Generic.ICollection1<**UNKNOWN TYPE**>).
at NHibernate.LambdaExtensions.SqlExpression.InG(Expression
1 expression, ICollection`1 values)
I can rebuild the query using QueryOver instead of Criteria and it will work, but doing that requires digging up alot of code that I don't have the time开发者_如何学Python to do. Using NH 3.0 I did not have the problem.
Has something changed in NH 3.1 or am I having some weird dll problem?
If you are using the Googlecode older style NH Lambda Extensions which were built on NH 2.1 assemblies, you have 2 options; - you can downgrade to 3.0 as you have or you can download the sourcecode and compile against the later binaries.
If you dont want to do this, I have a copy of NHlambdaextensions built against NH3.1, which includes all of the original tests passing to give you some coverage
精彩评论