Beispiel #1
0
        public async Task InitDataAsync()
        {
            var warehouse = new List <Warehouse>()
            {
                new Warehouse()
                {
                    Product = new Product
                    {
                        Name  = "小米笔记本Pro",
                        Price = 6599
                    },
                    StoreNum = 10
                },
                new Warehouse()
                {
                    Product = new Product
                    {
                        Name  = "三星S8",
                        Price = 4599
                    },
                    StoreNum = 8
                }
            };
            await _dbContext.AddRangeAsync(warehouse);

            await _dbContext.SaveChangesAsync();
        }