문제

In older version of NHibernate there was a method called "AddUsedTypedValues" in ICriteriaQuery. After upgrading to NHibernate 3.1, such a method does not exist. Does anyone know where was that method moved (to another interface) or NHibernate removed support for it explicitly?

Thanks!

도움이 되었습니까?

해결책

Method AddUsedTypedValues was replaced as well as the (AbstractCriterion : )ICriterion internal implementation. AddUsedTypedValues was a way how to inject parameters and they were later called inside ICriterion implementer like sqlStringBuilder.AddParameter(); (so the distance from Adding and usage was significant and not explicit) Current versions (3+) provides ICriteriaQuery method

IEnumerable NewQueryParameter(TypedValue parameter);

which can be used to get an array of Parameters and then explicitly used when SQL statement is built:

var parameter = criteriaQuery.NewQueryParameter(typedValue).Last()
sqlStringBuilder.Add(parameter); 

And now it is clear which parameter is added to a SQL statement. I had to implement my own ICrietrion, so I faced that issue as well...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top