如何从带有嵌套集合的上下文中获取对象作为id列表?
我想获得一个包含用户ID列表的Flat对象.
public IEnumerable<Flat> GetAll()
{
return _context.Flats
.Include(flat => flat.Users.Select(x => x.Id));
}
Run Code Online (Sandbox Code Playgroud)
错误返回:
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'.