Home > Net >  EF query statement
EF query statement

Time:12-29

There is a ArticleId, in an Article table Title, Content, CreateTime field
Another Comment table there are CommentId, Content, CreateTime, ArticleId (foreign key) field
How to implement according to the Comment list with EF each Article Comment for sorting, but not only retain the original field, the Article list LINQ
A similar effect as the chart

CodePudding user response:

Var myCollection=the from the collection in _context. Collection
The join Cases in _context. Case
On collection. CaseID equals Cases. ID
Where a collection. The UserID==_userManager. GetUserId (HttpContext. User)
Select new
{
Collection. CaseID,
Collection. UserID,
Cases in CaseName,
Cases. DecisionTime
};
Don't know whether what you said this

CodePudding user response:

More likely to use the db. The where (). The join (). The select (). The groupby () this way, but still thank you
  •  Tags:  
  • LINQ
  • Related