Exemplo n.º 1
0
        private void Seed()
        {
            using var context = new ItemsContext(this.ContextOptions);
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            var one = new Item("ItemOne");

            one.AddTag("Tag11");
            one.AddTag("Tag12");
            one.AddTag("Tag13");

            var two = new Item("ItemTwo");

            var three = new Item("ItemThree");

            three.AddTag("Tag31");
            three.AddTag("Tag31");
            three.AddTag("Tag31");
            three.AddTag("Tag32");
            three.AddTag("Tag32");

            context.AddRange(one, two, three);

            context.SaveChanges();
        }
        private void Seed()
        {
            using var context = new ItemsContext(this.contextOptions);

            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            var one = new Item {
                Name = "ItemOne"
            };

            var two = new Item {
                Name = "ItemTwo"
            };

            var three = new Item {
                Name = "ItemThree"
            };

            context.AddRange(one, two, three);

            context.SaveChanges();
        }