LearnAI ToolsCareerPractice BuildsPlayContact
Lesson 5718 min read

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.

It Builds on What You Already Know

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.SqlServer
dotnet add package Microsoft.EntityFrameworkCore.Tools

Database 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 PackageDatabase
Microsoft.EntityFrameworkCore.SqlServerSQL Server
Npgsql.EntityFrameworkCore.PostgreSQLPostgreSQL
Pomelo.EntityFrameworkCore.MySqlMySQL
Microsoft.EntityFrameworkCore.SqliteSQLite (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.
Next Lesson →

DbContext & Models