我尝试在 Linq 中创建一个连接查询。我想加入一个表多个相同的字段
桌子。请在下面查看我的代码。
var roles = (from ords in _orderRepository.Table
join customers in _customerRepository.Table on ords.CustomerId equals customers.Id
join ordprvrnts in _orderProductVariantRepository.Table on ords.Id equals ordprvrnts.OrderId
join prdvrnts in _productVariantRepository .Table on ordprvrnts.ProductVariantId equals prdvrnts.Id
**join cstevntrle in _customerEventRoleRepository.Table on
new{ customers.Id equals cstevntrle.CustomerId } &&
new { cstevntrle.EventId == model.Event}**
orderby customers.Email ascending
select new CustomerEventRolesModel
{
Customer = customers.Email,
CUstomerId =customers.Id
});
我尝试使用 CustomerId 和 EventId 过滤 customerEventRoleRepository.Table
我怎么能在这个连接查询中做到这一点。
请帮忙。