Example #1
0
        private void Initialize()
        {
            Beer       = new List <Beer>();
            Brewery    = new List <Brewery>();
            Wholesaler = new List <Wholesaler>();
            StockItem  = new List <StockItem>();

            var mockData = new GenesisBreweryMockData();

            mockData.Seed();

            Beer.AddRange(mockData.Beer);
            Brewery.AddRange(mockData.Brewery);
            Wholesaler.AddRange(mockData.Wholesaler);
            StockItem.AddRange(mockData.StockItem);
        }
Example #2
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity <Beer>().ToTable("Beer");
            modelBuilder.Entity <Brewery>().ToTable("Brewery");
            modelBuilder.Entity <Wholesaler>().ToTable("Wholesaler");
            modelBuilder.Entity <StockItem>().ToTable("StockItem");

            var mockData = new GenesisBreweryMockData();

            mockData.Seed();

            modelBuilder.Entity <Beer>().HasData(mockData.Beer);
            modelBuilder.Entity <Brewery>().HasData(mockData.Brewery);
            modelBuilder.Entity <Wholesaler>().HasData(mockData.Wholesaler);
            modelBuilder.Entity <StockItem>().HasData(mockData.StockItem);

            base.OnModelCreating(modelBuilder);
        }