I'm new about LinQ technologies. My program generates actions (moving files, deleting files, ...) and saves the status of each action in a database. Let's say that the statutes are simply passed (1) or failed (0). While my action isn't a success I try it again. For each trial I write a line in my database :
ID ProcessedOn ActionID Description Status
--- ----------------------- --------- ------------ ------
20 2011-05-20 10:45:01.440 24871 xxx 0
21 2011-05-20 10:45:09.080 24873 xxx 0
22 2011-05-20 11:00:01.993 24871 xxx 0
23 2011-05-20 11:00:10.477 24873 xxx 1
24 2011-05-20 11:15:08.127 24871 xxx 1
I would like to write a LINQ query to retrieve the latest status of each action between 2 moment. Is this possible?
I already wrote this :
MyTable.Where(t => t.ProcessedOn >= start).Where(t => t.ProcessedOn <=
stop).OrderBy(t => t.ProcessedOn).ToList();
This request requires an additional condition to keep only the last status. I need to keep the ProcessedOn greater time for each ActionID.