I have a query like so.
var query = from o in _context.Orders
join c in _context.Customers on o.CustomerId equals c.CustomerId
orderby o.ShippedDate descending
select new {OrderId = o.OrderId, Customer = c.FirstName};
I get the error “Only initializers, entity members, and entity navigation properties are supported”. I swear I have been able to do this before but for the life of me can’t understand what the issue is. I also can’t restructure the query like this either.
var query = from o in _context.Orders
orderby o.ShippedDate descending
select new {OrderId = o.OrderId, Customer = o.Customer.FirstName};
Baffled.
Try this: