Just my opinions on why someone might want to use code first:
If your database is not too complex then you have an easy to read set of files and classes that show what is in your database.
edmx files generate a lot of code that a developer may or may not be able to follow. With code first the code you write is all the code you need to check into source control
Large edmx files can be difficult to manage in the designer. Edmx files can take a while to open. Code First classes are just class files so they open and close super fast. You can go in, make a small change and save in a matter of seconds.
In my experience edmx files are easier to break. A connection string somehow changed, a table or filed accidentally removed.
Some developers just don't like code generated for them.
With code first you don't need the edmx designer in order to make changes to your model. You don't even need VS.net if you are using it in a non project type of application (web site).
Code First plays well with source control and you can easily see what has changed between one changeset and another.
I'm not saying that you can't do all the above with edmx files, but in my experience using code first can be a lot easier.
beetledev
Member
750 Points
173 Posts
Re: Why Code First with Existing DB?
Apr 09, 2012 04:59 PM|LINK
Just my opinions on why someone might want to use code first:
I'm not saying that you can't do all the above with edmx files, but in my experience using code first can be a lot easier.