Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.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
Linq 获取请求必须是简单的成员访问表达式';[100002]';而是一个子查询表达式_Linq_Fluent Nhibernate - Fatal编程技术网

Linq 获取请求必须是简单的成员访问表达式';[100002]';而是一个子查询表达式

Linq 获取请求必须是简单的成员访问表达式';[100002]';而是一个子查询表达式,linq,fluent-nhibernate,Linq,Fluent Nhibernate,我得到以下错误: “提取请求必须是简单成员访问表达式;“[100002]”改为子QueryExpression。参数名称:relatedObjectSelector” 以下是我的疑问: var query = session.Query<Customer().Where(cus => cus.CustomerId == customerId) .Fetch(c => c.CustomerType) // Parent CustomerType .Fetc

我得到以下错误: “提取请求必须是简单成员访问表达式;“[100002]”改为子QueryExpression。参数名称:relatedObjectSelector”

以下是我的疑问:

var query =
    session.Query<Customer().Where(cus => cus.CustomerId == customerId)
    .Fetch(c => c.CustomerType) // Parent CustomerType
    .Fetch(c => c.CustomerOrders) // Child Collection of orders
    .ThenFetch(co => co.Select(it => it.Item)).ToList(); // A parent of CustomerOrder
var查询=
session.Query cus.CustomerId==CustomerId)
.Fetch(c=>c.CustomerType)//父CustomerType
.Fetch(c=>c.CustomerOrders)//订单的子集合
.ThenFetch(co=>co.Select(it=>it.Item)).ToList();//CustomerOrder的父级
如果我取出'ThenFetch',那么我就不会得到那个错误。但是,我确实需要检索Item对象

有什么想法吗


谢谢

您不能在生成的CustomerOrder上应用select吗

var query =
    session.Query<Customer().Where(cus => cus.CustomerId == customerId)
    .Fetch(c => c.CustomerType)
    .Fetch(c => c.CustomerOrder)
    .Select(co => co.Item)
    .ToList();
var查询=
session.Query cus.CustomerId==CustomerId)
.Fetch(c=>c.CustomerType)
.Fetch(c=>c.CustomerOrder)
.选择(co=>co.Item)
.ToList();

。选择接受客户而不是客户订单