【发布时间】:2020-06-26 04:19:03
【问题描述】:
我想在域(Nop.Core => Domain)中添加不想包含在 nopcommerce 4.3 的表字段中的附加字段。实际上,我想要这个是因为我想在服务查询中从不同的表中获取数据。
这是我的代码:
protected virtual IQueryable<CustomerWastage> GetCustomerWastageQuery(int customerId)
{
var query = (from customerWastage in _customerWastageRepository.Table
join product in _productMasterRepository.Table on customerWastage.ProductID equals product.Id
join carat in _caratMasterRepository.Table on customerWastage.CaratID equals carat.Id
where customerWastage.CustomerID == customerId
select new CustomerWastage() { Wastage = customerWastage.Wastage, ProductName = product.Name,
Carat = carat.Carat, CustomerID = customerWastage.CustomerID });
return query;
}
这里 CustomerWastage 是一个域名,我想在其中添加其他字段,即
public string productname {get; set;}
public string Carat {get; set;}
但不想映射到表格中。
【问题讨论】:
标签: asp.net-mvc linq join nopcommerce