WCF RIA - One to Many, returning only first row
Hi I have the following relationships:
return this.ObjectContext.PCRs.Include("PApproval").Include("Details").Include("PApproval.PStatus");
"PApproval" table contains more then one row, however is it possible to only get the first record from that table based on the latest date(column L开发者_运维问答ast Updated on). Reason for this is so I can bind to my DXGrid, being able to show the latest approval status
You can try to order the results so the newest record will be first, then only select the first record.
return this.ObjectContext.PCRs.Include("PApproval").Include("Details").Include("PApproval.PStatus").OrderByDescending(x => x.LastUpdatedOn).First();
精彩评论