Say I have the following query
ICriteria query = session.CreateCriteria(typeof(T));
How can I find out the key field of T so that I can add an expression like so
query.Add(Expression.In(keyField, someListOfObjects.ToArray()));
Any ideas?
Say I have the following query
ICriteria query = session.CreateCriteria(typeof(T));
How can I find out the key field of T so that I can add an expression like so
query.Add(Expression.In(keyField, someListOfObjects.ToArray()));
Any ideas?
Use NH's meta data
var meta = factory.GetClassMetadata(typeof(T));
query.Add(Expression.In(meta.IdentifierPropertyName, someListOfObjects.ToArray()));