我有以下模型和视图模型(为简洁而编辑):
Order Model:
OrderId
ShippingAddressId
.....
Address Model:
AddressId
.....
OrderViewModel:
Some Property from Order Model and Address Model
如何内部连接两个表并映射到视图模型?
var query= from o in ctx.Orders
join addr in ctx.Addresses
on o.ShippingAddressId equals addr.AddressId
select new OrderViewModel.InjectFrom(o)
.InjectFrom(addr)
as OrderViewModel;
此代码不起作用。