Exemplo n.º 1
0
        public void ClearDB()
        {
            _ctx.Tags.RemoveRange(_ctx.Tags.ToList());
            _ctx.Books.RemoveRange(_ctx.Books.ToList());
            _ctx.Orders.RemoveRange(_ctx.Orders.ToList());
            _ctx.OrderEntries.RemoveRange(_ctx.OrderEntries.ToList());
            _ctx.Authors.RemoveRange(_ctx.Authors.ToList());

            _ctx.SaveChanges();

            new ELibrarySeeder(_ctx).Seed();
        }
Exemplo n.º 2
0
        void SeedTags()
        {
            _ctx.Tags.AddOrUpdate(x => x.Name,
                                  new Tag {
                Name = "Programming"
            },
                                  new Tag {
                Name = "C#"
            },
                                  new Tag {
                Name = ".Net"
            },
                                  new Tag {
                Name = "Software Design & Engineering"
            },
                                  new Tag {
                Name = "Enterprise Applications"
            },
                                  new Tag {
                Name = "Web Design"
            },
                                  new Tag {
                Name = "JavaScript"
            },
                                  new Tag {
                Name = "Data Structures"
            },
                                  new Tag {
                Name = "Windows Server"
            },
                                  new Tag {
                Name = "Unix"
            }
                                  );

            _ctx.SaveChanges();
        }