Skip to content
Learn Netverks

Lesson

Step 24/36 67% through track

ef-core-intro

Entity Framework Core intro

Last reviewed May 28, 2026 Content v20260528
Track mode
server_compiled
Means
Compiled runner
Reading
~1 min
Level
beginner

This lesson

An orientation to the ASP.NET track—how the server playground works, core vocabulary, and what you will practice next.

You need a clear map of the ASP.NET track so middleware, dependency injection, and the .NET project layout do not feel like magic.

You will apply Entity Framework Core intro in contexts like: Line-of-business CRUD, reporting databases, and multi-tenant SaaS on SQL Server or PostgreSQL.

Write C# (top-level or Program class), click Run on server—the dev runner uses dotnet build/run on a temp net8 project (requires .NET SDK; LEARNING_RUNNER_ENABLED=true). Also read the interview prep blocks.

After HTML fundamentals and basic programming concepts—before or alongside SQL.

Entity Framework Core (EF Core) is Microsoft's ORM for .NET—map C# classes to database tables, query with LINQ, and track changes. It supports SQL Server, PostgreSQL, SQLite, MySQL, and more via provider packages.

Why EF Core in ASP.NET

  • Productive CRUD without hand-written SQL for every query
  • Migrations version schema alongside code
  • Integrates with DI as scoped DbContext
  • Similar role to Django ORM or Java JPA/Hibernate

Registration in Program.cs

builder.Services.AddDbContext<AppDbContext>(options =>
    options.UseSqlServer(builder.Configuration.GetConnectionString("Default")));

Important interview questions and answers

  1. Q: EF Core vs Dapper?
    A: EF for model-centric apps and migrations; Dapper for hand-tuned SQL and micro-ORM performance.
  2. Q: DbContext thread-safe?
    A: No—use one instance per request (scoped lifetime).

Self-check

  1. What DI lifetime should DbContext use?
  2. Name one database provider besides SQL Server.

Interview prep

EF Core vs Dapper?

EF Core suits model-centric apps with migrations and change tracking; Dapper is a micro-ORM for hand-tuned SQL when you need maximum control.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • DbContext scope?
  • Code-first vs DB-first?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump