I saw the workaround when I need only a field (ex: min(date)).
In my case I have an order with more details (1 to N relationship) and I need to have all the data of the first detail row (quantity, price, ...)
My LINQ query is this:
Code: Select all
var query = from o in MyContext.Orders
let d = o.Details.OrderBy(x => x.Id).FirstOrDefault()
select new OrderDTO
{
Id = o.Id,
ProductId = d.ProductId,
Price = d.Price
Quantity = d.Quantity
}
Thank you in advance