📈
Entity FrameWork(EF) Ado.Net
  • Entity FrameWork
  • ORM(Object Relational Mapping)
  • Lazy Loading vs Eager Loading
  • Dapper
Powered by GitBook
On this page
  • *Model First:
  • *Database First:
  • *Code First:By Code
  • *Code First:By Use Database
  • Pros & Cons of Entity Framework

Was this helpful?

Entity FrameWork

In this passage i will explain why we use ado.net and why developers need ORM.

NextORM(Object Relational Mapping)

Last updated 4 years ago

Was this helpful?

Entity Framework is a tool for Object Relational Mapping.It is like a bridge between OOP and Relational Data Base.Entity Frame Work works as an assistans by getting data and bound your database object.Entity Framework works with Ado.Net.What is the Ado.Net? It contains UnitOfWork design pattern and written by Microsoft.For instance, adding, updating,deleting like this process we should create sentences String type.On the other hand,UnitOfWork doesn't need seperate all String process properly.It can manage these processes just by one source and u don't need to definite more String type.

We can create a project by using 4 different path with EntityFrameWork:

*Model First:

In this pattern, we create an empity modal file on the Visual Studio and add (.edmx) then we may design our database.At the compilation step Script file which is given creates database.

*Database First:

Database First pattern provides automatic class creating by using Entity Framework.In this pattern Database should be created before tie up project as a modal.

*Code First:By Code

In this pattern,All classes are created on the Visual Studio manually.Then Database derives from these classes.At that step Mapping processes can be manage thanks to Attributes.In addition to attributes Fluent Api and Fluent Validation can be used for Mapping process.

*Code First:By Use Database

At this pattern, as wee read before,it is similar.It means,developer created classes and mapping codes.Database updates in terms of class and models situation.

Pros & Cons of Entity Framework

Entity FrameWork

Advantage

Disadvantage

1

It provide clear code ın terms of OOP

The most important problem is performance .It's slower than Ado.Net but it is not the slowest.

2

Someone who dunno how to sql use can easily database operations by EF.

At the data transfer step we can not manage,in stead of us EF manages this process.I mean for a basic data it can create a complex sentence.You can see these SQL Server Profiler.

3

By Code First,U can reach your database from everywhere.It provides big flexibility for your project.

It can be complex for them who face with first time.

4

This descent of developing time.

EF doesn't work before updating Schema on the Solution.

5

This descent of developing funds.

references: medium.com/Recep Mert Aslan, c-sharpcorner.com/Emiliano Musso

*This is a map for choosing which patterns we need use.