0% found this document useful (0 votes)
3 views4 pages

Entity Framwork

Entity Framework (EF) is a Microsoft-developed ORM for .NET that allows developers to interact with databases using .NET objects instead of raw SQL. Key features include Object-Relational Mapping, LINQ support, change tracking, migrations, and loading strategies. It utilizes DbContext to manage database connections and CRUD operations, while DbSet<T> represents database tables as entity classes.

Uploaded by

Fareeha Butt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Entity Framwork

Entity Framework (EF) is a Microsoft-developed ORM for .NET that allows developers to interact with databases using .NET objects instead of raw SQL. Key features include Object-Relational Mapping, LINQ support, change tracking, migrations, and loading strategies. It utilizes DbContext to manage database connections and CRUD operations, while DbSet<T> represents database tables as entity classes.

Uploaded by

Fareeha Butt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Entity Framework:

Entity Framework (EF) is an Object-Relational Mapper (ORM) for .NET developed by Microsoft. It allows developers to interact with a database
using .NET objects, instead of writing raw SQL queries. EF simplifies data access by abstracting the database layer and mapping database tables to C#
classes.
Main Features of Entity Framework
• Object-Relational Mapping (ORM): Maps database tables to .NET classes.
• LINQ Support: Query the database using LINQ syntax.
• Change Tracking: Automatically tracks changes made to objects.
• Migrations: Manage database schema changes via code.
• Lazy/Eager Loading: Load related data on demand or immediately.

EF Approaches
Approach Description
Code First Define your C# classes, then EF generates the DB.
Database First Generate C# models from an existing database.

DbContext and DbSet:


➢ DbContext is a class provided by Entity Framework.
➢ It acts as a bridge between your C# code and the database.
➢ It's responsible for:
• Managing the database connection.
• Tracking changes to entities.
• Handling CRUD operations.
• Managing migrations and database creation.
➢ DbSet<T> represents a table in the database.
➢ T is the entity class, like Student.
➢ You can use it to query and save instances of the entity.

Step 1:
Step 2

Step 3

Step 4
Step 5

Step 6
Step 7

You might also like