无法为 openiddict 创建 dbset
Cannot create dbset for openiddict
错误:
Cannot create a DbSet for 'OpenIddictEntityFrameworkCoreApplication' because this type is not included in the model for the context.
我找到了 。
但是,此解决方案不适用于 .NET 5.0?
缺少对 OpenIddictApplication"、OpenIddictAuthorization、OpenIddictScope、OpenIddictToken 的引用?
- OpenIddict.AspNetCore" Version="3.0.0-beta6.20527.75
- OpenIddict.EntityFrameworkCore" Version="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> { }
这些实体已在 3.0 中重命名。您可以在此处找到完整列表:https://github.com/openiddict/openiddict-core/tree/dev/src/OpenIddict.EntityFrameworkCore.Models
错误:
Cannot create a DbSet for 'OpenIddictEntityFrameworkCoreApplication' because this type is not included in the model for the context.
我找到了
但是,此解决方案不适用于 .NET 5.0?
缺少对 OpenIddictApplication"、OpenIddictAuthorization、OpenIddictScope、OpenIddictToken 的引用?
- OpenIddict.AspNetCore" Version="3.0.0-beta6.20527.75
- OpenIddict.EntityFrameworkCore" Version="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> { }
这些实体已在 3.0 中重命名。您可以在此处找到完整列表:https://github.com/openiddict/openiddict-core/tree/dev/src/OpenIddict.EntityFrameworkCore.Models