What is Entity Framework?
Entity framework is an Object Relational Mapping (ORM) framework that offers an automated mechanism to developers for storing and accessing the data in the database.
Its purpose is to abstract the ties to a relational database, in such a way that the developer can relate to the database entity as to a set of objects and then to classes in addition to their properties.
Entity Framework Development Approaches:
There are mainly three approaches to create entity frameworks:
1. Code First Approach
2. Model First Approach
3. Database First Approach
The Entity Data Model:
The entity data model (EDM) is made up of three parts:
Conceptual Model: The conceptual model represents the model classes (also known as entities) and their relationships. This will be independent of the database table's architecture. It describes your business objects and their relationships in XML files.
Mapping Model: A mapping model specifies how the conceptual model is translated into a storage model. The Mapping model maps the conceptual and logical layers (storage layer). It integrates the business objects and relationships in the abstract layer with the tables and relationships in the logical layer.
Storage Model: The storage model represents the schema of the underlying database. The database design model contains tables, views, keys, stored procedures, and their relationships.
What Is an Entity in Entity Framework?
An entity is a class in an Entity Framework that maps the database tables.
Entities mainly consist of two types in an entity framework:
1. Scalar Property :
Scalar properties are those properties that are primitive. It maps a column in a database table that stores the data. E.g., student id, student name, class are the scalar property of a student entity.
2. Navigation Property :
This property is responsible for the relationship of one entity to another. There are two types of navigation properties:
Note: System.Data.Entity name space is used in EF and Project extension is ".edmx".
Comments
Post a Comment