EF Core (Entity Framework Core) is a lightweight, extensible, open-source, cross-platform Object-Relational Mapper (ORM) developed by Microsoft. It is the modern version of Entity Framework and is used to interact with relational databases using C# objects.
Key Features of EF Core
Feature
Description
ORM
Maps C# classes to database tables and columns.
LINQ Support
Query the database using LINQ syntax.
Migrations
Handles schema changes through code-based migrations.
Cross-platform
Works on Windows, Linux, macOS.
Database Providers
Supports SQL Server, SQLite, PostgreSQL, MySQL, Oracle, etc.
Change Tracking
Automatically tracks changes to objects for Insert, Update, or
Delete.
How EF Core Works
Define a Model (C# Classes)
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
}
Create a DbContext Class
public class AppDbContext : DbContext
{
public DbSet<Product> Products { get; set; }
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
}
Configure EF Core (e.g., in Startup.cs or
Program.cs)
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
EF Core (Entity Framework Core) is a lightweight, extensible, open-source, cross-platform Object-Relational Mapper (ORM) developed by Microsoft. It is the modern version of Entity Framework and is used to interact with relational databases using C# objects.
Key Features of EF Core
Insert,Update, orDelete.How EF Core Works
Define a Model (C# Classes)
Create a
DbContextClassConfigure EF Core (e.g., in
Startup.csorProgram.cs)Use EF Core in Code
Advantages
EF Core vs EF 6