Code-First or Database-First, how to choose?

后端 未结 11 1278
盖世英雄少女心
盖世英雄少女心 2020-12-23 16:34

Let us suppose we are going to start new project - application that contains some business logic, user interface on ASP.NET, WPF or both of them. We\'d like to use ORM or DA

11条回答
  •  猫巷女王i
    2020-12-23 17:24

    Personally I like control over creating RDBMS objects. When I use the EF code first, it actually created more work for basic things such as table relations etc. which most decent code generators does for you out of the box ( I know thats the idea ... more control on your Models!). Also the Idea that EFCF will generate the db as I am hoping for is a bit scary. (traditionally Code evolves more easily then RDMBS!)

    For a system which required constant evolving (for e.g. SaaS), and usually a large Enterprise Level system with 500 + tables etc, its can be less attrative proposition. On the other hand if you have a proper SQL Server 2008 database project with all the tables,SP,Triggers, Indexes scripted and you can deploy them from the Visual Studio it much more managble. You now have freedom of using any codegen you want for your tables (even build your own)

    You are not tied to the on Framework (EFCF) you can then use different ORMs (NHibernet for e.g.) depending upon your 'mini' project requirement in your large system.

提交回复
热议问题