Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions aspnetcore/blazor/blazor-ef-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ The grid, add, and view components use the "context-per-operation" pattern, wher
> [!NOTE]
> Some of the code examples in this topic require namespaces and services that aren't shown. To inspect the fully working code, including the required [`@using`](xref:mvc/views/razor#using) and [`@inject`](xref:mvc/views/razor#inject) directives for Razor examples, see the [sample app](#sample-app).

:::moniker range=">= aspnetcore-8.0"

## Build a Blazor movie database app tutorial

For a tutorial experience building an app that uses EF Core to work with a database, see <xref:blazor/tutorials/movie-database-app/index>. The tutorial shows you how to create a Blazor Web App that can display and manage movies in a movie database.

:::moniker-end

## Database access

EF Core relies on a <xref:Microsoft.EntityFrameworkCore.DbContext> as the means to [configure database access](/ef/core/miscellaneous/configuring-dbcontext) and act as a [*unit of work*](https://martinfowler.com/eaaCatalog/unitOfWork.html). EF Core provides the <xref:Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.AddDbContext%2A> extension for ASP.NET Core apps that registers the context as a *scoped* service. In server-side Blazor apps, scoped service registrations can be problematic because the instance is shared across components within the user's circuit. <xref:Microsoft.EntityFrameworkCore.DbContext> isn't thread safe and isn't designed for concurrent use. The existing lifetimes are inappropriate for these reasons:
Expand Down
20 changes: 19 additions & 1 deletion aspnetcore/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,25 @@ items:
- name: Build a Blazor todo list app
uid: blazor/tutorials/build-a-blazor-app
- name: Build a Blazor movie database app
uid: blazor/tutorials/movie-database-app/index
items:
- name: Overview
uid: blazor/tutorials/movie-database-app/index
- name: Create a Blazor Web App
uid: blazor/tutorials/movie-database-app/part-1
- name: Add and scaffold a model
uid: blazor/tutorials/movie-database-app/part-2
- name: Learn about Razor components
uid: blazor/tutorials/movie-database-app/part-3
- name: Work with a database
uid: blazor/tutorials/movie-database-app/part-4
- name: Add validation
uid: blazor/tutorials/movie-database-app/part-5
- name: Add search
uid: blazor/tutorials/movie-database-app/part-6
- name: Add a new field
uid: blazor/tutorials/movie-database-app/part-7
- name: Add interactivity
uid: blazor/tutorials/movie-database-app/part-8
- name: SignalR with Blazor
uid: blazor/tutorials/signalr-blazor
- name: Learn modules
Expand Down
Loading