public static void Seed(CatalogEventContext catalogEventContext) { catalogEventContext.Database.Migrate(); if (!catalogEventContext.CatalogEventCategories.Any()) { catalogEventContext.CatalogEventCategories.AddRange(GetCatalogEventCategories()); catalogEventContext.SaveChanges(); } if (!catalogEventContext.CatalogEventTypes.Any()) { catalogEventContext.CatalogEventTypes.AddRange(GetCatalogEventTypes()); catalogEventContext.SaveChanges(); } if (!catalogEventContext.CatalogEventItems.Any()) { catalogEventContext.CatalogEventItems.AddRange(GetCatalogEventItems()); catalogEventContext.SaveChanges(); } }
public static void Seed(CatalogEventContext context) { context.Database.Migrate(); if (!context.EventCategories.Any()) { context.EventCategories.AddRange (GetPreconfiguredEventCategory()); context.SaveChanges(); } if (!context.EventType.Any()) { context.EventType.AddRange (GetPreconfiguredEventType()); context.SaveChanges(); } if (!context.EventItem.Any()) { context.EventItem.AddRange (GetPreconfiguredEvent()); context.SaveChanges(); } }