EF: Include with where clause

前端 未结 4 1372
执念已碎
执念已碎 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:27

    Disclaimer: I'm the owner of the project Entity Framework Plus

    EF+ Query IncludeFilter feature allows filtering related entities.

    var buses = Context.Busses
                       .Where(b => b.IsDriving)
                       .IncludeFilter(x => x.Passengers.Where(p => p.Awake))
                       .ToList();
    

    Wiki: EF+ Query IncludeFilter

提交回复
热议问题