Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# LINQ到NHibernate和let关键字_C#_.net_Linq_Nhibernate_Linq To Nhibernate - Fatal编程技术网

C# LINQ到NHibernate和let关键字

C# LINQ到NHibernate和let关键字,c#,.net,linq,nhibernate,linq-to-nhibernate,C#,.net,Linq,Nhibernate,Linq To Nhibernate,可以将let关键字与nhibernate linq一起使用吗? 我写 var posts=来自postsrespository.GetPosts(名称)中的post 让CommentScont=(来自NHUnitOfWork.CurrentSession.Linq()中的c) 其中c.Post.ID==Post.ID 选择c.Count() 选择新的。。。 作为回应,我有 NHibernate.QueryException:无法解析的属性:post of:Sys.Domain.Entities

可以将let关键字与nhibernate linq一起使用吗? 我写

var posts=来自postsrespository.GetPosts(名称)中的post
让CommentScont=(来自NHUnitOfWork.CurrentSession.Linq()中的c)
其中c.Post.ID==Post.ID
选择c.Count()
选择新的。。。
作为回应,我有

NHibernate.QueryException:无法解析的属性:post of:Sys.Domain.Entities.post


评论的映射有问题。Post

您的评论可能链接到了您的帖子?你不能用分组接线员吗?
 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 ...