Why does Entity Framework 6 generate complex SQL queries for simple lookups?

前端 未结 4 1493
半阙折子戏
半阙折子戏 2020-12-17 01:07

I have this LINQ query

dbContext.Customers.Where(c => c.AssetTag == assetTag).Count();

or

(from c in dbContext.Customers         


        
4条回答
  •  余生分开走
    2020-12-17 01:33

    In EF6 the database null semantics is the default comparison semantics. Note that this is a change to the default setting in EF5. In EF5 this flag was buried in ObjectContext.ContextOptions.UseCSharpNullComparisonBehavior and by default EF would use Linq to Object comparison semantics. In EF6 it is exposed on DbContext as DbContext.Configuration.UseDatabaseNullSemantics. You can find more details here

提交回复
热议问题