Question

How can I create one query using both ICriteria and Linq? Example:

var q = Session
.Query<T>()
.Where(x.Id == 1)
.ToCriteria()
.Add(Restrictions.Eq("Title", "Ayende @ Rahien"))
.List<T>();
Était-ce utile?

La solution

I think, you should use QueryOver for it:

var q = Session
.QueryOver<T>()
.Where(x.Id == 1)
.Add(Restrictions.Eq(Projections.Property<T>(x.Title), "Ayende @ Rahien"))
.List<T>();
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top