protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); builder.Entity <AppUser>().HasMany <Chat>().WithOne(m => m.GetUser_1).OnDelete(DeleteBehavior.Restrict); builder.Entity <AppUser>().HasMany <Chat>().WithOne(m => m.GetUser_2).OnDelete(DeleteBehavior.Restrict); builder.Entity <Chat>().HasOne <AppUser>().WithMany(m => m.GetChates_1).OnDelete(DeleteBehavior.Restrict); builder.Entity <Chat>().HasOne <AppUser>().WithMany(m => m.GetChates_2).OnDelete(DeleteBehavior.Restrict); RoleSeed.Seed(builder); UserSeed.Seed(builder); UserRoleSeed.Seed(builder); CountrySeed.Seed(builder); CitySeed.Seed(builder); }