0

I have this LINQ query:

from device in _context.Device
from data in _context.Data.OrderByDescending(_ => _.Time).Take(1)
select data;

I use it with .NET5 EF, and I have navigation properties.

Device looks like this:

Device 
------------ 
DeviceId int (Primary key)
DeviceInformation varchar(max)  
...

Data looks like this:

Data  
------------ 
DataId int (Primary key)  
DeviceId int (Foreign key for Device)  
Time datetime
...

How can I convert it as a lambda query?

Yunnosch
  • 26,130
  • 9
  • 42
  • 54
geebacsi
  • 135
  • 2
  • 10
  • Or https://stackoverflow.com/q/56547/861716, etc. – Gert Arnold Dec 04 '20 at 08:56
  • 1
    Please do not edit solution announcements into the question. If you really have a relevantly different solution that the duplicate please contact @GertArnold and convince them that this is not a duplicate. Or write reasons into comment here or edit the question to highlight the difference. Then, when the question is reopened, add an answer. – Yunnosch Dec 07 '20 at 15:46

0 Answers0