protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity <ProductDetails>() .HasData(Initial.Data()); base.OnModelCreating(modelBuilder); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity <StockItem>().HasData(Initial.Data()); var shoppingCartItemEntity = modelBuilder.Entity <ShoppingCartItem>(); shoppingCartItemEntity.Property(i => i.Id).ValueGeneratedOnAdd(); base.OnModelCreating(modelBuilder); }
public static void CreateSeedData() { using (var db = new MarketingContext()) { foreach (var productDetails in Initial.Data()) { db.ProductsDetails.Add(productDetails); } db.SaveChanges(); } }
public static void CreateSeedData() { using (var db = new SalesContext()) { foreach (var productPrice in Initial.Data()) { db.ProductsPrices.Add(productPrice); } db.SaveChanges(); } }
public static void CreateSeedData() { using (var db = new WarehouseContext()) { foreach (var stockItem in Initial.Data()) { db.StockItems.Add(stockItem); } db.SaveChanges(); } }
internal static void CreateSeedData(string databaseName = null) { if (!string.IsNullOrWhiteSpace(databaseName)) { _databaseName = databaseName; } using var db = new SalesContext(); foreach (var productPrice in Initial.Data()) { db.ProductsPrices.Add(productPrice); } db.SaveChanges(); }
internal static void CreateSeedData(string databaseName = null) { if (!string.IsNullOrWhiteSpace(databaseName)) { _databaseName = databaseName; } using var db = new MarketingContext(); foreach (var productDetails in Initial.Data()) { db.ProductsDetails.Add(productDetails); } db.SaveChanges(); }
internal static void CreateSeedData(string databaseName = null) { if (!string.IsNullOrWhiteSpace(databaseName)) { _databaseName = databaseName; } using var db = new WarehouseContext(); foreach (var stockItem in Initial.Data()) { db.StockItems.Add(stockItem); } db.SaveChanges(); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity <ProductPrice>().HasData(Initial.Data()); var shoppingCartItemEntity = modelBuilder.Entity <ShoppingCartItem>(); var shoppingCartEntity = modelBuilder.Entity <ShoppingCart>(); shoppingCartItemEntity .HasOne <ShoppingCart>() .WithMany(sc => sc.Items) .IsRequired() .HasForeignKey(so => so.CartId) .OnDelete(DeleteBehavior.Cascade); base.OnModelCreating(modelBuilder); }