1)いいえ
2)はい、あなたはこれを行うが、あなたは1つのコンテキストでそれを実装することを優れていることができます。 どうすればこのことができますか?あなたの答えはここにある:あなたのcustom
アイデンティティPOCOSを作成
ApplicationDbcontext.cs
public class ApplicationDbContext :IdentityDbContext<User, Role, Guid, UserLogin, UserRole, UserClaim>
{
public ApplicationDbContext() :
base("Server=.;Initial Catalog=TestDb;Integrated Security=true;MultipleActiveResultSets=True;")
{
}
public DbSet<Person> Peoples { get; set; }
// add poco classes here
}
:
public class User : IdentityUser<Guid, UserLogin, UserRole, UserClaim>
public class Role : IdentityRole<Guid,UserRole>
public class UserLogin : IdentityUserLogin<Guid>
public class UserRole : IdentityUserRole<Guid>
public class UserClaim : IdentityUserClaim<Guid>
今あなたが1 DbContextを持っており、削除することができ はApplicationDbcontext
のクラス名を作成しますIdentiyMode.cs
exこのコマンドecute:あなたは他のDbContext
IdentityContext
を必要としないAdd-Migration init
とUpdate-Database --verbose
を継承DbContext
:あなたが実際には2つのDbContextsを持っている必要があれば(私はなぜ好奇心が強いので
public class IdentityDbContext<TUser, TRole, TKey, TUserLogin, TUserRole,
TUserClaim> : DbContext
」 ) "..私は2 dbcontextsから単一のdbcontextを作ることに慣れていません。それが誤りを投げるかもしれないかどうかを恐れています。 – Abhijith