I have a class defined as follows:
public class SearchResult
{
public Customer Customer { get; set; }
public Receipt Receipt { get; set; }
public IEnumerable<ReceiptDetail> ReceiptDetail { get; set; }
}
In my Linq query i would like to return a single SearchResult record but have problems in returning the List of ReceiptDetail. If i do:
var list=(from cust in dbContext.Customers
join rec in dbContext.Receipts on cust.IdCustomer equals rec.IdCustomer
join recdet in dbContext.ReceiptDetails on rec.IdReceipt equals recdet.IdReceipt
select new SearchResult
{
Customer=cust,
Receipt=rec,
ReceiptDetail = (from r1 in recdet select r1).ToList() // COMPILER ERROR HERE
}).ToList();
I get the "Could not find an implementation of the query pattern for source type ReceiptDetail 'Select' not found".
What am i doing wrong?