dilemma: Within Visual Web Developer Express, Should I...
1. Allow Entity Framework to create model and CRUD scaffolding for a project.
2. connect to existing SQL database without the benefit of Entity creating the model.
Is there an advantage to allowing the columns / fields to be created through Entity Framework?
If I create model through Entity, I will have to reenter field details for about 100 columns / fields (e.g. distinguishing field type detail such as int / tinyint / small int / bigint/ varchar(max 50 / varchar)).
If you have an existing database, choose the database first approach. When you say scaffolding, I think you just mean the ability to CRUD various entities. There are also ASP.NET MVC Scaffolding Templates that create the MVC pages for CRUD as well, combined
with Entity Framework you could create a CRUD application very quickly. For a tutorial, see this article: http://msdn.microsoft.com/en-us/data/gg685489
If you want to write code and just code, and then let EF figure out how to save your classes to the database, use the code-first approach.
And if you do not have a database and want to use a designer for the modeling experience because you are a visual person (and not code-first), use the model first approach.
Darrell Norton, MVP
Darrell Norton's Blog Please click "Mark as Answer" if this helped you.
Marked as answer by 3v3rhart on Feb 03, 2012 02:02 PM
3v3rhart
Member
159 Points
317 Posts
Entity Framework CRUD Scaffolding v existing SQL database
Feb 02, 2012 12:38 AM|LINK
dilemma: Within Visual Web Developer Express, Should I...
1. Allow Entity Framework to create model and CRUD scaffolding for a project.
2. connect to existing SQL database without the benefit of Entity creating the model.
Is there an advantage to allowing the columns / fields to be created through Entity Framework?
If I create model through Entity, I will have to reenter field details for about 100 columns / fields (e.g. distinguishing field type detail such as int / tinyint / small int / bigint/ varchar(max 50 / varchar)).
Thanks!
Dean
DarrellNorto...
All-Star
86795 Points
9644 Posts
Moderator
MVP
Re: Entity Framework CRUD Scaffolding v existing SQL database
Feb 02, 2012 09:28 AM|LINK
There are three approaches for using EF:
Code-First
Model-First
Database-First
If you have an existing database, choose the database first approach. When you say scaffolding, I think you just mean the ability to CRUD various entities. There are also ASP.NET MVC Scaffolding Templates that create the MVC pages for CRUD as well, combined with Entity Framework you could create a CRUD application very quickly. For a tutorial, see this article: http://msdn.microsoft.com/en-us/data/gg685489
If you want to write code and just code, and then let EF figure out how to save your classes to the database, use the code-first approach.
And if you do not have a database and want to use a designer for the modeling experience because you are a visual person (and not code-first), use the model first approach.
Darrell Norton's Blog
Please click "Mark as Answer" if this helped you.
3v3rhart
Member
159 Points
317 Posts
Re: Entity Framework CRUD Scaffolding v existing SQL database
Feb 03, 2012 02:04 PM|LINK
Thank you Darrell.
Looks like i'll be following the database first tutorial you suggested.
Thanks again.
Dean