コード例 #1
0
        public override void Generate()
        {
            this.Logger.LogMessage("Adding categories");
            for (int i = 0; i < this.Count; i++)
            {
                var category = new Category
                {
                    Name = this.Random.GetRandomStringWithRandomLength(5, 20)       // Change it!
                };

                this.Database.Categories.Add(category);

                if (i % 100 == 0)
                {
                    this.Logger.LogMessage(".");
                    this.Database.SaveChanges();
                }
            }

            this.Logger.LogMessage(" Categories added!\n");
        }
コード例 #2
0
        public override void Generate()
        {
            Console.WriteLine("Adding categories");
            for (int i = 0; i < this.Count; i++)
            {
                var newCategory = new Category
                {
                    Name = this.Random.GetRandomStringWithRandomLength(5, 50)
                };

                this.Database.Categories.Add(newCategory);

                if (i % 100 == 0)
                {
                    Console.Write(".");
                    Database.SaveChanges();
                }
            }
            Console.WriteLine();
            Console.WriteLine("Categories added!");
        }