Nthatuoa Ts'ilo
1 min readJun 28, 2020

--

Entity Framework

Entity Framework is an Object Relational Mapper (ORM) which makes mapping between objects and tables in a database easy by eliminating the need to manually map database tables and manage database tables.

Entity framework supports three workflows: Code first, Database first and Model first.

Code first: you first create domain classes and then have entity framework generate data tables from those classes.

Advantages

This approach is simple because you do not have the database model to maintain or update.

· Since you do not have to worry about creating a database, development speed is increased.

Database first: you first design the database and create database tables and the entity framework creates the corresponding domain classes.

Advantages

· Data loss is avoided because changes will be made to the database.

· Classes can be generated from existing databases and database tables so it saves the time of creating or recreating the database.

Model first: in this approach, you first create UML diagrams and entity framework will generate domain classes and database tables from the diagrams.

Advantages

· The model can be updated whenever there is a change to the database to avoid data loss.

This was just a brief introduction of entity framework. I will explain each workflow and show examples in the next section. I hope this gives you an idea of what entity framework is.

--

--