Domanda

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!

È stato utile?

Soluzione

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...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top