Skip to content

You need to specify optionsLifetime? #1

Description

@Tihifas

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions