Entity Framework .Where method chaining

后端 未结 3 430
猫巷女王i
猫巷女王i 2020-12-29 03:38

Is there any difference between these two ways of querying the context?

Firm firm = base.context.Firms
            .Where(f => f.SomeId == someId)
                


        
3条回答
  •  南笙
    南笙 (楼主)
    2020-12-29 04:27

    My guess is that as long as you are working with in IQueryable (as your context collections probably are), using the chained extensions vs the full predicate clause achieves the same thing. This is because IQueryable allows for deferred execution so essentially the same SQL is being generated behind the scenes.

提交回复
热议问题