开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜