Exemplo n.º 1
0
 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();
     }
 }
Exemplo n.º 2
0
        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();
            }
        }