Fea*_*inn 1 c# entity-framework-core .net-core asp.net-core identityserver4
我正在尝试使用 ef-core 和 dotnet 3.1 创建我自己的 UI 以将 CRUD Identity 客户端插入到 Identity Server 4,但我遇到了一个问题,我的 ConfigurationDbContext 没有 SaveChanges() 方法。
我可以从数据库中读取现有数据没有任何问题,我有 Add() 方法,但奇怪的是 SaveChanges() 方法只是丢失了......
我已按如下方式注入服务。
private readonly IConfigurationDbContext ConfigurationDbContext;
private readonly IPersistedGrantDbContext PersistedGrantDbContext;
public ResourceManagementController(
IConfigurationDbContext configurationDbContext,
IPersistedGrantDbContext persistedGrantDbContext)
{
ConfigurationDbContext = configurationDbContext;
PersistedGrantDbContext = persistedGrantDbContext;
}
Run Code Online (Sandbox Code Playgroud)
原来我需要注入 ConfigurationDbContext 而不是 IConfigurationDbContext。似乎 SaveChanges 方法是直接从 DbContext 继承的,而不是通过 IConfigurationDbContext 继承的。
归档时间: |
|
查看次数: |
359 次 |
最近记录: |