EF: Include with where clause

前端 未结 4 1380
执念已碎
执念已碎 2020-11-21 07:45

As the title suggest I am looking for a way to do a where clause in combination with an include.

Here is my situations: I am responsible for the support of a large a

4条回答
  •  北荒
    北荒 (楼主)
    2020-11-21 08:40

    For any one still curious about this. there builtin functionality for doing this in EF Core. using .Any inside of a where clause so the code would like similar to something like this

    
    
    _ctx.Parent
        .Include(t => t.Children)
        .Where(t => t.Children.Any(t => /* Expression here */))
    

提交回复
热议问题