예제 #1
0
        public async Task SeedAsync(int retry = 0)
        {
            try
            {
                dbContext.Database.Migrate();

                if (!await dbContext.Customers.AnyAsync())
                {
                    dbContext.Customers.AddRange(CustomerSeed.GetTestData());
                }

                if (!await dbContext.Countries.AnyAsync())
                {
                    dbContext.Countries.AddRange(CountrySeed.GetTestData());
                }

                if (!await dbContext.Cities.AnyAsync())
                {
                    dbContext.Cities.AddRange(CitySeed.GetTestData());
                }

                await dbContext.SaveChangesAsync();
            }
            catch (Exception)
            {
                if (retry > 0)
                {
                    await SeedAsync(retry - 1);
                }
            }
        }
예제 #2
0
 public static void SeedData(DatabaseContext context, UserManager <Person> userManager, RoleManager <Entities.IdentityRole> roleManager)
 {
     RoleSeed.SeedData(roleManager);
     PersonSeed.SeedData(context, userManager);
     CitySeed.SeedData(context);
     BrandSeed.SeedData(context);
 }
        public AnimationWindow(int cityCount, int rowCount, int columnCount)
        {
            InitializeComponent();

            this.WindowState = WindowState.Maximized;

            Cities = CitySeed.SeedData(cityCount, rowCount, columnCount);
            PrepareTable(rowCount, columnCount);

            DrawGrid();
            GenerateCities();
        }
예제 #4
0
    private static void OpenWindow()
    {
        GameObject cityObject = GameObject.FindWithTag("CG_CitySeed");

        if (cityObject != null)
        {
            city = cityObject.GetComponent(typeof(CitySeed)) as CitySeed;
            city.Start();
        }
        CitySeedEditorWindow window = GetWindow <CitySeedEditorWindow>();

        window.titleContent = new GUIContent("City Editor");
    }
예제 #5
0
        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);
        }