Wednesday, 13 April 2016

What is an Entity Framework and Different Approaches

Introduction of Entity Framework (EF)
Entity Framework was first released in 2008. Microsoft's primary means of interacting between .Net application and relational database.

Entity Framework is an Object Relational Mapper (ORM). Which is type of tool that simplifying mapping between objects in our .net application to the table and columns of a relational database.

Entity Framework is an open source framework for ADO.Net which is a part of .Net Programmer.

What is the aim of Entity Framework (EF)?
Entity Framework  is an ORM to increase the developer's productivity by reducing the redundant task of persisting the data used in applications.

Entity Framework can generate the necessary db commands for reading or writing data in the database and execute them.

If you have any query you can express your queries against your domain object using Language Integrated Query (LINQ) to Entities.

Simple Entity Framework execute the relevant query in the database.

Other ORM in the market is NHibernate, LLBLGen Pro. etc...

Features of Entity Framework
  • Entity Framework is a Microsoft Tool. It is being developed as an open source product.
  • Entity Framework is no longer ties or dependent to the .net release cycle which is best to us.
  • It works with any relational database with valid Entity Framework provider.
  • Entity Framework will create parametrized query. Tracks Changes to in-memory objects.
  • Allows to CRUD operation command generation.
  • Works with a visual model or with your own classes.
  • Entity Framework has supported stored procedure. 


What is relationship and how to set relation ship using entity framework?
Relationship is define how one entity related to one another table. There are three types of relationship between tables and the relational tables.

1) One to One Relationship
A one to one relationship is where one entity instance interact with one another entity instance. you can see below example image.



2) Many to Many Relationship
A many to many relationship is where multiple instance can interact with many other entity instance. you can see below example image.



3) One to Many Relationship.
A one to many relationship is where one instance interact with many other entity instance. you can see below example image.




What is an Entity Data Model (EDM)?
Entity Data Model is an external version of the entity relational model which specifies the conceptual model of the data using various modelling technique.

Entity Data Model is a set of concepts that describe the structure of data. regardless stored form.

Entity Data Model support  a set of primitive data types that define properties in a conceptual model.

EDM have three core parts.
1. The storage schema model
2. The conceptual model
3. The Mapping model

The entity framework provides three types of approach each have own pros and cons.

Code First
Database First
Model First

Next post >>


No comments:

Post a Comment