Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Device
- {
- [Key]
- public int Id { get; set; }
- public class DeviceStatus
- {
- [Key]
- public int Id { get; set; }
- [...]
- public Device Device { get; set; }
- }
- var statusMac =
- from status in actiContext.DeviceStatus.OfType<DeviceStatus>().Include(s => s.Device)
- where status.Device.Mac == mac
- select status
- ;
- var lastStatusMac =
- from status in statusMac
- group status by status.Device.Id
- into g
- select g.Where(s1 => s1.TimeStamp == g.Max(s2 => s2.TimeStamp));
- var lastStatusMac =
- from status in statusMac**.toList()**
- group status by status.Device.Id
- into g
- select g.Where(s1 => s1.TimeStamp == g.Max(s2 => s2.TimeStamp));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement