Entity Framework Core

1 question found

What is Entity Framework Core (EF Core)? How is it different from EF6?

Intermediate
Entity Framework Core is a lightweight, open source, and cross platform object relational mapper that lets developers work with a database using C# objects instead of writing raw SQL, and it supports a wide range of database providers including SQL Server, PostgreSQL, MySQL, and SQLite. Compared to the older Entity Framework 6, which only runs on Windows through the full dot NET Framework, EF Core is faster, more modular, and designed from the ground up to work with dot NET Core's cross platform and dependency injection friendly architecture, though it initially lacked a few advanced features that EF6 had, most of which have since been added back over time.
public class AppDbContext : DbContext {
    public DbSet<Product> Products { get; set; }
}

var products = await _context.Products
    .Where(p => p.Price > 100)
    .ToListAsync();
Real-world example An inventory management application uses EF Core to query and update product records as regular C# objects, letting developers write LINQ queries instead of manually crafting SQL statements for every database operation.

Common follow-ups: What is the difference between Code First and Database First approaches in EF Core?;How do EF Core migrations work?

Configuration & Options Pattern;Dependency Injection in .NET Core