I have this error in this linq expression :
var naleznosci = (from nalTmp in db.Naleznosci
where nalTmp.idDziecko == idDziec
If you're like me and don't want to have to populate your properties for each query you're building, there is another way to solve this issue.
var query = from orderDetail in context.OrderDetails
join order in context.Orders on order.OrderId equals orderDetail.orderId
select new { order, orderDetail };
At this point you have an IQueryable containing an anonymous object. If you want to populate your custom object with a constructor you can simply do something like this:
return query.ToList().Select(r => new OrderDetails(r.order, r.orderDetail));
Now your custom object (which takes two objects as a parameter) can populate your properties as needed.