Why does Entity Framework Code-First (with an existing DB) keep trying get data from an EdmMetadata table?

前端 未结 1 1460
梦谈多话
梦谈多话 2021-02-09 11:52

i\'m trying do some Entity Framework Code First programming to an existing database .. but I keep seeing this code in my Sql Profiler :-

SELECT   TOP (          


        
1条回答
  •  鱼传尺愫
    2021-02-09 12:46

    There is no Code-First against existing database. If you have database you are doing Database-first. In such case your mapping is driven by database.

    EdmMetadata table keeps hash of current code-first model and it allows DbContext detecting changes of model so that database can be recreated. This feature is turned on by default. You can turn it off by removing convention in OnModelCreating:

    modelBuilder.Conventions.Remove();
    

    0 讨论(0)
提交回复
热议问题