I have a query to get all Orders with detail . I have a query like this :
return
_orderMasters.OrderByDescending(row => row.Code).Where(row => row.Code == code).Include(row => row.Orderdetails)
.Select(row => new OrderViewModel
{
Code = row.Code,
// other fields
Items = row.Orderdetails.Select(detail => new OrderItemViewModel
{
ProductcombinationId = detail.ProductCombinationId,
ProductId=detail.ProductAttributeCombination.ProductId,
ProductName = detail.ProductCombination.Product.Name,
ProductCombinationName=_productCombinationService.GetCombinationsName(detail.ProductCombinationId,detail.ProductCombination.ProductId) // * this row
}).ToList(),
ShippingAddress = new AddressViewModel()
{
//set fileds value
}
}).FirstOrDefault();
In line that *
I need get ProductcombinationName , to do this I call Method in another Service , but getting this Error :
LINQ to Entities does not recognize the method
First Idea Is , add foreach
for All rows and call that Method to get ProductcombinationName , But I don't know is it a good way ?