What is the difference between 'Database First' and 'Code First to Existing Database' in Entity Framework

后端 未结 1 757
情歌与酒
情歌与酒 2021-01-03 16:38

I have just watched the MSDN video about the new \'Code First to Existing Database\' functionality in EF6.1

http://channel9.msdn.com/Blogs/EF/Code-First-to-Existi

相关标签:
1条回答
  • 2021-01-03 17:22

    Code First is sort of a misnomer... What it should really be called is "Code Based Model" vs "XML Based Model".

    Code first creates an in-memory model based on attributes on classes and/or fluent mappings in code.

    Database and Model first create an in-memory model based on a .EDMX file, which is then used to generate classes.

    ie. Code first uses the code as its model. Database and Model first use the EDMX file as it's model. Code First to existing database just generates code first classes (attributes and/or fluent mapping), while database first generates an EDMX file which then generates classes via T4 templates.

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