2010-10-29 37 views
6

這是可能的使用let關鍵字與nhibernate linq? 我寫LINQ到NHibernate,讓關鍵字

var posts = from post in postsRepository.GetPosts(name) 
      let commentsCount = (from c in NHUnitOfWork.CurrentSession.Linq<Comment>() 
            where c.Post.ID == post.ID 
            select c).Count() 
      select new ... 

,並響應我有

NHibernate.QueryException:無法解析屬性:帖子:Sys.Domain.Entities.Post

+0

想必您的評論與您的​​帖子相關聯?你不能使用組運營商嗎? – 2010-11-04 09:26:53

回答