MultiThreadedEFCoreSample
MultiThreadedEFCoreSample copied to clipboard
You need to specify optionsLifetime?
Hi. I found you proposed fix 1 useful, but I had to do something extra to make it work.
When added parameter AddDbContext(.., contextLifetime:ServiceLifetime.Transient) in startup.cs i got exception Initialization method CLASS threw exception. System.InvalidOperationException: Cannot resolve 'IUnitOfWork' from root provider because it requires scoped service 'Microsoft.EntityFrameworkCore.DbContextOptions`1 . I made it work by adding another parameter: AddDbContext(..., contextLifetime:ServiceLifetime.Transient, optionsLifetime: ServiceLifetime.Transient).
I use Microsoft.EntityFrameworkCore 6.0.0, in case it matters