Im very newbie to the .net world… I’m going across some tutorials for MVC, where in I could see all the tutorials are writing the Model classes then creating the database(may be used for tutorial sake). But I have the question for the real projects we dont generate the Models and then create database.. rather we do generate the Models according to the database.
So after so much googling and reading different blogs I came to know that we can use ADO.Net Entity Data Model to generate the DataContext. Also I came to know that we need not write the models manually because Entity Data Model generates all the Model classes according to the database.
Can anyone tell me that for real world projects do we use the ADO.Net Entity Data Model to generate the classes and we dont need to write any Model classes on our own.
Please correct if Im wrong…
Thanks in advance
Exactly. You can extract model classes out of your existing database.
For more on this subject, take a look at this blog post:
EF 4.2 Model & Database First Walkthrough
This is the important part in the post linked above:
This is the article that’ll show you a complete MVC app created using the Database First approach:
Building an MVC 3 App with Database First and Entity Framework 4.1