Author : MD TAREQ HASSAN | Updated : 2020/10/26

What is Entity Framework?

What is Entity Framework Core?

Entity Framework (EF) Core is the lightweight, extensible, and cross-platform version of Entity Framework.

Model

The term “Model” is ambiguous. Following are all models

See: https://entityframework.net/knowledge-base/26563444/entity-vs-model-vs-view-model

VVI: Model in context of Entity Framework may mean: Entity Data Model (EDM)

Entity

Entity in different context

Entity is the model (class) within ORM that is reprensting a table row in the database

Entity Type

Entity Type in EF edmx = Entity Class in app

Conceptual Model

An abstract specification for the entity types, complex types, associations, entity containers, entity sets, and association sets in the domain of an application in the Entity Framework. The conceptual model is defined in CSDL in the .csdl file.

Here a conceptual model in edmx diagram

A conceptual model in edmx diagram

Entity Data Model / Model

Entity Framework Model = EF model = Entity Data Model = Model A set of concepts that describe the structure of data, as entities and relationships, regardless of its stored form.

A model that describes entities and the relationships between them. EF uses EDM to describe the conceptual model against which the developer programs. EDM builds on the Entity Relationship model introduced by Dr. Peter Chen. The EDM was originally developed with the primary goal of becoming the common data model across a suite of developer and server technologies from Microsoft. EDM is also used as part of the OData protocol.

There are two main ways to create an EF model:

More: https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/entity-data-model

Entity Framework Mapping

DataBase Table <===> Conceptual Model (.edmx) <===> Entity Class (domain class)

EF mapping - table | conceptual model | entity class (domain class)

EF mapping - table | conceptual model | entity class (domain class)

Context

A class that represents a session with the database, allowing you to query and save data. A context derives from the DbContext or ObjectContext class.

Entity Framework Aproaches

Lazy loading

A pattern of loading related data where related objects are automatically loaded when a navigation property is accessed.

Eager loading

A pattern of loading related data where a query for one type of entity also loads related entities as part of the query.

More Terminologies