したがって、テーブルに整数の主キーを使用するようにアプリケーションを変更しました(途方もないプロセスです)。すべてうまく動作します。私ApplicationDbContext
クラスを考えてみましょう:Asp.net IDコンテキストがカスタムクラスなしでマッピングされていません
public class ApplicationDbContext : IdentityDbContext<ApplicationUser, CustomRole, int, CustomUserLogin, CustomUserRole, CustomUserClaim>, IIDentityContext
{
public ApplicationDbContext()
: base("OwinTestDefault")
{
Database.SetInitializer<ApplicationDbContext>(null);
}
...
}
今全体的に、例えば、ここに私のユーザーのログインクラスを考えてみましょう。
public class CustomUserLogin : IdentityUserLogin<int>
{
}
このためだけにクラスを作るために持っている愚か見えた、とすることをしかし
public class ApplicationDbContext : IdentityDbContext<ApplicationUser, CustomRole, int, IdentityUserLogin<int>, CustomUserRole, CustomUserClaim>, IIDentityContext
{
public ApplicationDbContext()
: base("OwinTestDefault")
{
Database.SetInitializer<ApplicationDbContext>(null);
}
...
}
、bafflingly、それは今仕事とtしません:私はちょうど今、この結果として、コードにIdentityuserLogin<int>
でこれのすべてのインスタンスを置き換えることができるはずですエラーをhrows:
The type 'Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin`1[System.Int32]' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive or generic, and does not inherit from EntityObject.`
は周りの検索、彼らは彼らのテーブル名を変更したとき、一部の人々は、このに遭遇してきたが、私はこれを行っていない、とにかかわらず、OnModelCreatingをオーバーライドして、明示的に私は(テーブル名できることはすべてをマッピングしますキー、列名、プロパティ)は効果がなく、まだマップされていないという不満があります。さらに、GitHubの基本クラスのソースコードを見ると、マッピングはうまくいくはずです。
アイデア?