public static void InitDbContext(ModelBuilder modelBuilder, bool initializeDerivedContext) { if (initializeDerivedContext) { UserDbContext.InitDbContext(modelBuilder); modelBuilder.Entity <Login>().HasOne(x => x.LoginUser); GroupDbContext.InitDbContext(modelBuilder); modelBuilder.Entity <Login>().HasOne(x => x.LoginGroup); } else { modelBuilder.Ignore <Group>(); } modelBuilder.Entity <Login>().HasData(new Login { LoginId = ConstStore.AdminLoginIdGuid, GroupId = ConstStore.AdminGroupIdGuid, UserId = ConstStore.AdminUserIdGuid, LogIn = ConstStore.AdminLogIn, Certificate = CertificateWorker.CreateCertificate(), Password = Hasher.Hash(ConstStore.AdminSecure) }); }