Intro: Entity Framework
Recently I had a Job Interview asking about Entity Framework, since I don't have a background in EF I had to tell him some idea that I have about Entity Framework, I'm not coming in empty with regards to Object Relational Mapping Tools (ORM) which is what Entity Framework is. I had an experience working with DevForce Ideablade and CSLA.net back then CSLA was almost the de facto standard.
So I did some research about Entity Framework to better understand the concepts and details behind it.
Here are some of my research findings:
You basically have three options on how to approach it:
So I did some research about Entity Framework to better understand the concepts and details behind it.
Here are some of my research findings:
You basically have three options on how to approach it:
- Database First
- Model First
- Code First
Let's discuss each.
Database First
Here you have an existing database that you can use to create your models. There's an Entity Framework Menu once you install the Entity Framework Powertools. Basically you select your database from your source and it will automatically generate your entities.
Model First
With this approach you are starting from scratch you don't have a database to start with, so using the entity designer included in Visual Studio you create your own models/entities which is called the Entity Data Model or ED, here's where the magic is happening using EDM, entity framework will use it to create your Data Definition Language or DDL to create the actual Tables.
Code First:
Here you basically start coding your entity and let entity framework do the mapping later. I think its somewhat similar to Model First since your also doing models but just not using the Model Designer.
I haven't explored the advantages for each approach but will go into the details of in some other post, For now we know the basic concept.
Next we'll dive into coding Entity Framework with samples.
Next we'll dive into coding Entity Framework with samples.
Comments