which way? Database-first , model-first , Code-Only?

风流意气都作罢 提交于 2019-12-07 10:03:08

问题


recently I learned Entity Framework by Pro Entity Framework 4.0 book...

Now,I want to write the project by EF ...With these conditionsو which way is better and more flexible?

My opinion is the Model-first! however I want to know your opinion?

thanks!


回答1:


Read this: EF 4.1. Which way to go?

It goes through the permutations based on your preferences and situation. My opinion mimics what is stated. If you don't have an existing database and dislike visual designers, code first is for you. If you do have an existing database, database first makes sense. Model first I in general avoid as the cases mentioned above cover my needs, but some people enjoy that mode of work.

The blurb also references this article which goes more in depth if you like.

EDIT 5/30/2011:

I'm going to add in here the new EF Power Tools CTP1. With this you can take an existing database and generate a code first setup. Here's a quick example of using it. This is a good alternative for someone who really wants to use code first but has a database already built up.




回答2:


And here is a short (2 min) MSDN video on the primary differences and when to use what.



来源:https://stackoverflow.com/questions/6060715/which-way-database-first-model-first-code-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!