I am writing a simple community Plugin and now I wanted to improve my db queries but run into an blocking isse:
this is the query:
TRDCommunityViewModel community = await _db.Communities
.Select(c => new TRDCommunityViewModel
{
Id = c.Id,
CommunityId = c.Guid,
Created = c.Created,
Description = c.Description,
IAmAdmin = (c.Admins.FirstOrDefault(k => k.Id == userId) != null),
Members = c.Members.Select(a => new List<TRDIdenityViewModel>()
{
// member vars of TRDIdenityViewModel arn't accessible
// ???
}),
Posts = c.Posts.Select(a => new List<TRDIdenityViewModel>()
{
//member vars of TRDIdenityViewModel arn't accessible
})
// and so on
})
.FirstOrDefaultAsync(k => k.Id == Id);
My question is...how is it possible to query for related lists? Members and Posts are ICollections
Thx for helping.