简体   繁体   English

无法为 openiddict 创建 dbset

[英]Cannot create dbset for openiddict

Error:错误:

Cannot create a DbSet for 'OpenIddictEntityFrameworkCoreApplication' because this type is not included in the model for the context.

I found this solution .我找到了这个解决方案

However, this solution does not work for .NET 5.0?但是,此解决方案不适用于 .NET 5.0?

Missing reference to OpenIddictApplication" , OpenIddictAuthorization , OpenIddictScope, OpenIddictToken?缺少对 OpenIddictApplication"、OpenIddictAuthorization、OpenIddictScope、OpenIddictToken 的引用?


  • OpenIddict.AspNetCore" Version="3.0.0-beta6.20527.75 OpenIddict.AspNetCore”版本=“3.0.0-beta6.20527.75
  • OpenIddict.EntityFrameworkCore" Version="3.0.0-beta6.20527.75 OpenIddict.EntityFrameworkCore”版本=“3.0.0-beta6.20527.75

public class ApiHubContext : DbContext
{
    public ApiHubContext(DbContextOptions options)
        : base(options) { }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);
        builder.UseOpenIddict<ApplicationClient, ApplicationAuthorization, ApplicationScope, ApplicationToken, long>();
    }
}

public class ApplicationClient : OpenIddictApplication<long, ApplicationAuthorization, ApplicationToken>
{

    public bool IsActive { get; set; }
    public string Remarks { get; set; }
}

public class ApplicationAuthorization : OpenIddictAuthorization<long, ApplicationClient, ApplicationToken> { }
public class ApplicationScope : OpenIddictScope<long> { }
public class ApplicationToken : OpenIddictToken<long, ApplicationClient, ApplicationAuthorization> { }

These entities have been renamed in 3.0.这些实体已在 3.0 中重命名。 You can find the complete list here: https://github.com/openiddict/openiddict-core/tree/dev/src/OpenIddict.EntityFrameworkCore.Models您可以在此处找到完整列表: https : //github.com/openiddict/openiddict-core/tree/dev/src/OpenIddict.EntityFrameworkCore.Models

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法为&#39;IdentityRoleClaim创建DbSet <int> &#39; - Cannot create a DbSet for 'IdentityRoleClaim<int>' 数据库集.Cast<TEntity> () 错误:无法创建 DbSet<IEntity> 来自“实体”类型对象的非通用 DbSet - DbSet.Cast<TEntity>() Error: Cannot create a DbSet<IEntity> from a non-generic DbSet for objects of type 'Entity' 无法为“ApplicationUser”创建DbSet,因为此类型未包含在上下文的模型中 - Cannot create a DbSet for 'ApplicationUser' because this type is not included in the model for the context InvalidOperationException:无法为“角色”创建 DbSet,因为此类型未包含在上下文的 model 中 - InvalidOperationException: Cannot create a DbSet for 'Role' because this type is not included in the model for the context 无法为“ IdentityUser”创建DbSet,因为此类型不包含在上下文模型中 - Cannot create a DbSet for 'IdentityUser' because this type is not included in the model for the context .Net核心单元测试错误:无法为“ IdentityRole”创建DbSet,因为此类型不包含在上下文模型中 - .Net Core Unit Tests error: Cannot create a DbSet for 'IdentityRole' because this type is not included in the model for the context ASP.NET Core 2.1 - IdentityUser 问题 - 无法为“IdentityUser”创建 DbSet 此类型未包含在上下文模型中 - ASP.NET Core 2.1 - IdentityUser Issue - Cannot create a DbSet for 'IdentityUser' this type is not included in the model for the context 具有自定义返回类型的 Entity Framework Core - 无法为“BookInfo”创建 DbSet,因为此类型未包含在上下文模型中 - Entity Framework Core with Custom Return Type - Cannot create a DbSet for 'BookInfo' because this type is not included in the model for the context 无法解析“无法为 'OpenIddictEntityFrameworkCoreApplication 创建 DbSet”,因为此类型未包含在上下文的 model 中。 - Can't resolve "Cannot create DbSet for 'OpenIddictEntityFrameworkCoreApplication" because this type is not included in the model for the context." Openiddict 可以创建令牌但似乎无效 - Openiddict can create token but seems to be invalid
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM