Please enable JavaScript.
Coggle requires JavaScript to display documents.
Entity Framework - Coggle Diagram
Entity Framework
Loading
Lazy Loading
The related entities are not loaded until we iterate or data bind through them. Seperate queries are written to load the data.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
LINQ
-
-
-
-
Linq to SQL format is 1. From Clause, 2. Order By or Group By and 3. Select columns. From t.Tasks order by t.id Select t.id, t.name, t.rank
EF is Persistence Framework - It keeps track of all entities during its lifetime. This is useful in windows applications with the local database or the database on the same network.
Steps to use EF
-
-
Create an app.config entry of Connection String. Name it the same as "dbcontext" class to use advantage of Convention over configuration (pattern avoids manual configuration)
Code-First Approach
-
-
-
-
Migration class is created in Migrations folder and consists of Up (Create statements) and Down (Drop and Alter methods) methods.
Seed Data
-
-
-
History of Migration execution is stored in "dbo.__MigrationHistory". This table contaions -Migrationid, ContextKey, Model and ProductVersion
-
Use Collections features to Save, Update and Delete data to DB
Add extension methods in Model Classes for easy reading of data from Models. e.g., public static string ToString() { return name field only; }
-
-
-
-
-