I have a SQL Statement that I am trying to convert to a LINQ query. I need to do this because I can\'t edit my database :(. Regardless, I have a SQL Statement that looks like th
You can just nest the Linq to Entities query as well:
var results = from x in context.MyEntities
select new Customer()
{
CustomerID = x.CustomerID,
FirstName = x.FirstName,
LastName = x.LastName,
Gender = x.Gender,
BirthMonth = x.BirthMonth,
TotalPurchases = context.PurchaseOrders
.Where(po=>po.CustomerId == x.CustomerId)
.Count()
};