linq技巧-通过使用匿名类型来构造一个多属性连接查询表达式

1 var orders = from o in context.Orders
2     join a in context.Accounts on
3     // 使用匿名类型来构造一个复合的查询表达式
4     new { Id = o.AccountId, City = o.ShipCity, State = o.ShipState }
5     equals
6     new { Id = a.AccountId, City = a.City, State = a.State }
7     select o;

 

posted @ 2017-03-24 19:09  woolhoo  阅读(444)  评论(0编辑  收藏  举报