Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to develope MVC 4 Ecommerse Application using Entity framework and my database is MYSql .
Please tell me which one is best options to develope my project

1.Code First
2.DataBase First
3.Model First
Posted

1. Code first
In the Code First approach, we focus on the domain design or entities/POCO classes first and create classes as per our model requirement. We do not have the database of the application, rather we create database automatically from code after defining our domain.
No matter, you are not an expert in database, if you are a C# developer, just focus on your model/class creation. EntityFramework will take headache of creating and managing database for you.

2. Database first
To meet the needs of developers who want to derive a domain model from an existing database, database first approach provides a set of modeling tools that generate a domain model, validate a domain model, and create persistent classes based on the storage (database) model.

3. Model first
With the model first approach, you can design a model in a designer. Or you can simply define classes and let EF work with those—referred to as code first. Also in that approach EntityFramework will take headache of creating and managing database and classes for you.

End of the point this is clear if you have good command on database and already created database structure then you can choose database first, in other hand you have good command over the oop and coding and want to do everything by design model then choose Code first approach, and if you want to create very simple application and simple kind of database without any class model or database then you can choose model first.
 
Share this answer
 
Comments
Raul Iloc 22-Jan-15 2:28am    
You have my 5!
Manoj Kumar Choubey 22-Jan-15 3:03am    
Thank you :)
Hi Shailesh,

Have a look on "Decision tree" given here (answered by Bahador Izadpanah):
http://stackoverflow.com/questions/5446316/code-first-vs-model-database-first[^]

and an article on MSDN by Julie Lerman:
https://msdn.microsoft.com/en-us/magazine/hh148150.aspx[^]

Thanks.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900