I am new to LinQ technology. My program generates actions (moving files, deleting files, ...) and saves the status of each action in the database. Let's say that the charters are simply passed (1) or unsuccessful (0). Although my actions were unsuccessful, I will try again. For each test, 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 get the last status of each action in 2 points. Is it possible?
I already wrote about this:
MyTable.Where(t => t.ProcessedOn >= start).Where(t => t.ProcessedOn <= stop).OrderBy(t => t.ProcessedOn).ToList();
This query requires an additional condition in order to keep only the last status. I need to save ProcessedOn more time for each ActionID.
source share