我尝试在 nopCommerce 3.0 中创建一个 linq 连接查询。我在 linq 中加入两个表并写
代码成功。但视觉工作室智能显示错误
带有语句体的 lambda 表达式不能转换为表达式树
请在下面查看我的代码
var roles = _customerEventRoleRepository.Table.Where(c => c.EventId == selevent)
.Join
(
_customerRepository.Table,
cev => cev.CustomerId, c => c.Id,
(cev, c) =>
{
var cust = new CustomerEventRolesModel();
cust.Id = cev.Id;
cust.CustomerId = c.Id;
cust.Customer = c.Email;
cust.ContactName = c.GetAttribute<string>(SystemCustomerAttributeNames.FirstName);
cust.CompanyName = c.GetAttribute<string>(SystemCustomerAttributeNames.Company);
cust.Speaker = cev.IsSpeaker;
cust.Sponsor = cev.IsSponser;
return cust;
}
).OrderBy(cev => cev.Customer).ToList();
但错误显示
请帮忙