dotnet / dotnet/EntityFramework.Docs

Show how to change the provider when using WebApplicationFactory

Open
#4,149 0 comments 0 reactions 0 assignees View on GitHub
area-in-memory needs-design
Dominant language
Mermaid
Stars
1.7k
Forks
2k
Avg merge
7d 23h
Merged PRs (30d)
16

Description

When using [WebApplicationFactory](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.testing.webapplicationfactory-1) to test the app changing the provider is currently not straightforward. See https://github.com/davidfowl/TodoApi/blob/aa5761d4ad3c516eae27d8a7fa41d8b97c812d63/TodoApi.Tests/DbContextExtensions.cs and https://github.com/davidfowl/TodoApi/blob/aa5761d4ad3c516eae27d8a7fa41d8b97c812d63/TodoApi.Tests/TodoApplication.cs#L39-L46

We should have specific guidance on how this can be done without bringing new dependencies to the app.

This can be simplified by adding `AddDbContextOptions` to EF

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.