IdentityServer3 with EntityFramework



我希望这是简单而易于解决的事情。我已经在现有项目中安装了 IdentityServer3 ,并设法使"内存"内容正常工作。现在,我正在连接我的 usermanager 。当我尝试进行身份验证时,我会收到此错误:

"在模型生成过程中检测到一个或多个验证错误: r n r ncormar.sql.claim :: entityType'索赔'sipple'没有定义密钥。定义该EntityType的密钥。 r nCormar。SQL.ClaimSIdentity :: EntityType"索赔Identity"没有定义密钥。定义该EntityType的钥匙。 r ncormar.sqormar.sql.SidentityReference :: EntityType" IdentityReference"'IdentalityReference''sidentyReference'没有键。ncormar.sql.secret :: entityType"秘密"没有定义键。定义此EntityType的钥匙。 r ncormar.sql.sql.refreshtoken :: entityType'refreshtoken'refreshtoken''refreshtoken'没有密钥定义。r ncormar.sql.token :: entityType'token'没有键定义。定义该entityType的键。。。r nsecrets:entityType:entitySet'secrets'基于没有定义的键的类型"秘密"。 r nrefreshtokens:entityType:entityType:entitySetse'refreshtokens'基于没有定义的键的'refreshtoken'基于'felcReshtoken'。ntokens:entityType:entitySet'tokens'基于未定义键的类型"令牌"。 r nscopes:entityType:entitySetsepe'scopes'scopes'基于未定义的键。EntityType:EntitySet'scopeclaims'基于未定义键的类型" scopeclaim"。 r n"

我认为这可能是因为我缺少一个软件包,所以我使用 nuget 来安装 IdentityServer3.entityFramework ,但这不起作用。有人知道如何解决这个问题吗?

这足够直接,您必须具有 IdentityServer3.entityFramework 。我看了看源并看到了迁移类,所以我只是简单地将实体添加到我的 dbcontext 中:

public DbSet<Client> Clients { get; set; }
public DbSet<ClientClaim> ClientClaims { get; set; }
public DbSet<ClientSecret> ClientSecrets { get; set; }
public DbSet<Consent> Consents { get; set; }
public DbSet<Scope> Scopes { get; set; }
public DbSet<ScopeClaim> ScopeClaims { get; set; }

然后我做了add-migrationupdate-database。这为我创建了桌子,一切都是tickity-boo

最新更新