开发者

WCF RIA - One to Many, returning only first row

开发者 https://www.devze.com 2023-04-01 05:28 出处:网络
Hi I have the following relationships: return this.ObjectContext.PCRs.Include(\"PApproval\").Include(\"Details\").Include(\"PApproval.PStatus\");

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();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号