dotnet / dotnet/EntityFramework.Docs
Show how to change the provider when using WebApplicationFactory
- 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
Assessment
This issue has not been assessed yet.