Skip to content

Commit

Permalink
IDbContextFactory in 3.x sample app (#20025)
Browse files Browse the repository at this point in the history
  • Loading branch information
guardrex authored Sep 28, 2020
1 parent f70fb78 commit 37da523
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion aspnetcore/blazor/blazor-server-ef-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ The recommended solution to create a new <xref:Microsoft.EntityFrameworkCore.DbC

[!code-csharp[](./common/samples/3.x/BlazorServerEFCoreSample/BlazorServerDbContextExample/Data/DbContextFactory.cs)]

In the preceding factory, <xref:Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance%2A?displayProperty=nameWithType> satisfies any dependencies via the service provider.
In the preceding factory:

* <xref:Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance%2A?displayProperty=nameWithType> satisfies any dependencies via the service provider.
* `IDbContextFactory` is available in EF Core ASP.NET Core 5.0 or later, so the interface is [implemented in the sample app for ASP.NET Core 3.x](https://github.com/dotnet/AspNetCore.Docs/blob/master/aspnetcore/blazor/common/samples/3.x/BlazorServerEFCoreSample/BlazorServerDbContextExample/Data/IDbContextFactory.cs).
The following example configures [SQLite](https://www.sqlite.org/index.html) and enables data logging. The code uses an extension method to configure the database factory for DI and provide default options:
Expand Down

0 comments on commit 37da523

Please sign in to comment.