سلام آقای مدائنی گفتید برا Identity از sample استفاده کنید و استفاده کردم
ولی اون یه دیتابیس جدا درست کرده و برا خود سایت هم دیتابیس جدا
به چه صورت این دو را ترکیب کنم که یک دیتابیس بشه ؟
این برا خود دیتابیس سایت هست DBCONTEXT
namespace Base_Management.Models { public class BaseBsjDbContext:System.Data.Entity.DbContext { public BaseBsjDbContext() { } public DbSet<Verdict> Verdicts { get; set; } public DbSet<Martial> Martials { get; set; } public DbSet<Force> Forces { get; set; } public DbSet<Recall> Recalls { get; set; } public DbSet<LettersOperation> Letteroperations { get; set; } public DbSet<ForceInRecall> ForceInRecalls{ get; set; } public DbSet<Leader.Council> Councils{ get; set; } public DbSet<Message> Messages { get; set; } } }
لازم نیست دوباره یک Context جدید بسازید میتوانید از Context خود Identity استفاده کنید و DbSet ها را داخل آن تعریف کنید.
خب چه dbset هایی از identity باید داخلش بنویسم ؟
DbContext خودتان را حدف کنید و DbSet های خود را درون ApplicationDbContext قرار بدید:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext() : base("DefaultConnection", throwIfV1Schema: false) { } public DbSet<Verdict> Verdicts { get; set; } public DbSet<Martial> Martials { get; set; } public DbSet<Force> Forces { get; set; } public DbSet<Recall> Recalls { get; set; } public DbSet<LettersOperation> Letteroperations { get; set; } public DbSet<ForceInRecall> ForceInRecalls { get; set; } public DbSet<Leader.Council> Councils { get; set; } public DbSet<Message> Messages { get; set; } public static ApplicationDbContext Create() { return new ApplicationDbContext(); } }
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)