Entity Framework Core Introduction
Learn what Entity Framework Core is and how it lets you work with databases using C# instead of raw SQL.
What is an ORM?
An Object-Relational Mapper (ORM) translates between C# objects and database rows automatically, so you write queries in C# instead of raw SQL strings scattered through your code.
What is Entity Framework Core?
Entity Framework Core (EF Core) is Microsoft's official, cross-platform ORM for .NET. It lets you define your database schema using C# classes, then query and modify data using LINQ.
EF Core queries are written in LINQ — the same LINQ from earlier in this course. EF Core translates your LINQ expressions into SQL behind the scenes.
Installing EF Core
dotnet add package Microsoft.EntityFrameworkCore.SqlServerdotnet add package Microsoft.EntityFrameworkCore.ToolsDatabase Providers
EF Core supports many databases through different provider packages — the C# code you write stays nearly identical regardless of which one you choose.
| Provider Package | Database |
|---|---|
| Microsoft.EntityFrameworkCore.SqlServer | SQL Server |
| Npgsql.EntityFrameworkCore.PostgreSQL | PostgreSQL |
| Pomelo.EntityFrameworkCore.MySql | MySQL |
| Microsoft.EntityFrameworkCore.Sqlite | SQLite (great for learning/local dev) |
FAQs
Yes — EF Core handles the everyday queries elegantly, but understanding SQL helps you debug generated queries and optimize performance for complex cases.
Summary
- An ORM maps between C# objects and database rows.
- EF Core is Microsoft's official ORM, using LINQ to query data.
- Different provider packages let EF Core target SQL Server, PostgreSQL, MySQL, SQLite, and more.