Hello Is it possible in nhibernate to createCriteria expression.in with string of csv, for example
public static List<T> ToList(string csvOnly)
{
ISession session = NhSessionMenager.Instance.GetSession();
List<T> l = session.CreateCriteria(typeof(T)).Add(Expression.In("Id",csvOnly)).List<T>().ToList();
return l;
}
and the string will be: "1,2,3,4,5,6,7,8" ?
You can probably use string.split
to split these up into an array. I don't think Expression.In takes a comma separated string.
string [] split = csvOnly.Split(new Char [] {','});
List<T> l = session.CreateCriteria(typeof(T)).Add(Expression.In("Id",split)).List<T>().ToList();