How do I get an object from context with a nested collection as an id list?
I want to get a Flat object containing a list of user IDs.
public IEnumerable<Flat> GetAll()
{
return _context.Flats
.Include(flat => flat.Users.Select(x => x.Id));
}
The error returned:
The property expression 'flat => {from User x in flat.Users select [x].Id}' is not valid. The expression should represent a property access: 't => t.MyProperty'.
Flats
objects also get list of IDs from users associated with each flat?