문제

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>();
도움이 되었습니까?

해결책

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>();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top