小编Imp*_*erC的帖子

下载嵌套集合

如何从带有嵌套集合的上下文中获取对象作为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'.

c# asp.net .net-core asp.net-core

2
推荐指数
1
解决办法
46
查看次数

标签 统计

.net-core ×1

asp.net ×1

asp.net-core ×1

c# ×1