Entity Framework – an Introduction

In this article, I will provide introduction about entity framework. Before knowing about Entity framework, first let’s see what is ORM framework.

What is ORM framework?

ORM stands for Object relational mapping. The ORM framework allows you map object models of C# classes to relational databases.

ORM framework is useful to maintain databases in the application and saves a lot of time for the developer thus increases developer productivity.  Key points of ORM framework:

  • ORM framework can create classes based on database tables.
  • It can create database tables based on class models.
  • It helps you connect databases and executing SQL queries.

What is Entity Framework?

Entity framework is an ORM (Object relational mapping) framework. This framework is written on the top of ADO.Net, which is part of .NET framework. So, internally entity framework uses ADO.Net.

Entity framework generates model objects and entities based on database tables and vice versa.  You can easily add relationships (like 1 to1 or 1 to many) between different entities. It allows you to perform basic CRUD (create, Read, Update and Delete) operations over the database tables.

Features

  • Less code- Less management: Entity framework reduces the total code to write as compared with ADO.Net, thus increases productivity.
  • All the data access related logic can be written in C#. You can also specify relationships between entities in the code only. So maintaining the databases becomes easy for the developers.
  • The database tables and relationships can be seen in the designers integrated to visual studio. It simplifies the mapping process.
  • Entity framework supports LINQ for queries.

Entity Framework Models

Conceptual Model

Conceptual model includes model classes and relationship between different entities. Conceptual schema definition language (CSDL) defines the conceptual model.

Storage Model

Storage model describes the database description. It is also called the logical model. It includes tables, stored procedures, different keys (primary key and foreign key) and relationships between tables. Storage schema definition language (SCDL) defines the storage model.

Mapping Model

Mapping model implements the relation between conceptual model and storage model. This is the real magic of entity framework. How a class is mapped to a database table and vice versa; these entire things are taken care by mapping model. Mapping specification language (MSL) defines the mapping between conceptual model and storage model.

Architecture

Enitity Framework - architecture

This Framework allows you to create entity model by following approaches:

I will explain details about these three approaches in next articles.

That’s it for this article. Please post your comments for queries and feedback. Thanks for reading.

Share Button
The following two tabs change content below.
Gyanendu Shekhar is a technology enthusiast. He loves to learn new technologies. His area of interest includes Microsoft technologies, Augmented reality, Virtual reality, unity3d and android development.

Latest posts by Gyanendu Shekhar (see all)

Gyanendu Shekhar

Gyanendu Shekhar is a technology enthusiast. He loves to learn new technologies. His area of interest includes Microsoft technologies, Augmented reality, Virtual reality, unity3d and android development.

One thought on “Entity Framework – an Introduction

Leave a Reply

Your email address will not be published. Required fields are marked *