No SaveChanges Method on IConfigurationDbContext with Identity Server 4

Viewed 590

I'm trying to create my own UI to CRUD Identity clients into Identity Server 4 using ef-core and dotnet 3.1 but I have an issue where I my ConfigurationDbContext doesn't have a SaveChanges() method.

I can read existing data from the database no without any issues and I have the Add() method but weirdly the SaveChanges() method is just missing...

I have injected the service as follows.

 private readonly IConfigurationDbContext ConfigurationDbContext;
 private readonly IPersistedGrantDbContext PersistedGrantDbContext;

public ResourceManagementController(
    IConfigurationDbContext configurationDbContext,
    IPersistedGrantDbContext persistedGrantDbContext)
      {
          ConfigurationDbContext = configurationDbContext;
          PersistedGrantDbContext = persistedGrantDbContext;
      }
1 Answers

Turns out I needed to Inject ConfigurationDbContext rather than IConfigurationDbContext. It seems the SaveChanges Method is Inherited directly from DbContext rather than Via IConfigurationDbContext.

Related