[ad_1]
If you want to convert this to the method syntax version, you can do this step by step. I like to start at the end and work through to the beginning:
selecttoSelectdefines the source:.Select(g => g.OrderByDescending(s => s.MeasureDate).FirstOrDefault());groupisGroupBy:.GroupBy(s => s.SensorUnitId) .Select(g => g.OrderByDescending(s => s.MeasureDate).FirstOrDefault());fromthe sourceSensorObservationEntities.SensorsMeasures .GroupBy(s => s.SensorUnitId) .Select(g => g.OrderByDescending(s => s.MeasureDate).FirstOrDefault());
[ad_2]
solved How to convert linq query to non-query expression?