Click here to Skip to main content
15,746,420 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

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
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):[^]

and an article on MSDN by Julie Lerman:[^]

Share this answer

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