1 var mySet = (from e in dbset.AsNoTracking().Where(specification.SatisfiedBy()) 2 join m in base.DataContext.CorpShop on e.CSID equals m.CSID//门店 3 join o in base.DataContext.CorpSalesOrderProductDetail on e.OrderNo equals o.OrderNo//商品 4 join p in base.DataContext.CorpSalesOrderECHolder on e.OrderNo equals p.IDCardNo//接收人 5 6 select new { e.AccountName, e.AccountTel, e.Receivables, e.ActualReceive, e.PostTime, e.OrderStateEF, e.PayTime, e.PayTypeEF, e.UpdateTime, e.OrderCreateTypeEF, e.ClosingStateEF, e.Taobao_OrderNo, e.Taobao_OrderStateEF, e.OrderNo, e.CUNickName, m.ThirdShopTypeEF} 7 ).ToList().Select(x => new OrderSearchDTO() { AccountName = x.AccountName, AccountTel = x.AccountTel, ActualReceive = x.ActualReceive, PostTime = x.PostTime, OrderState = (OrderState)x.OrderStateEF, PayTime = x.PayTime, PayType = (PayType)x.PayTypeEF, UpdateTime = x.UpdateTime, OrderCreateType = (OrderCreateType)x.OrderCreateTypeEF, ClosingState = (ClosingState)x.ClosingStateEF, Taobao_OrderNo = x.Taobao_OrderNo, Taobao_OrderState = (TaobaoTradeState)x.Taobao_OrderStateEF, OrderNo = x.OrderNo, CUNickName = x.CUNickName, Receivables = x.Receivables, ThirdShopType = (ThirdShopType)x.ThirdShopTypeEF});
描述:我现在是读取订单表的数据 上面条件最后两个是一个订单有多条数据的外键关系 现在问题来了 在Select new 的时候 我要怎么得到商品 和 接收人的List数据 有不清楚的请告诉我
看着有点晕。
你商品定义的别名是o 接受人表的别名是p
在Select New 里面 写o.XXXX,p.XXX就可以啊。不知道你是不是这个意思。