Ejemplo n.º 1
0
 /// <summary>
 /// see dbcontext with data
 /// </summary>
 public static TradePMRDbContext Seed(this TradePMRDbContext context)
 {
     if (!context.Accounts.Any())
     {
         context.AddRange(Seeder.Accounts());
         context.SaveChanges();
     }
     if (!context.Trades.Any())
     {
         context.AddRange(Seeder.Trades());
         context.SaveChanges();
     }
     return(context);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// seed builder with data
 /// </summary>
 public static void Seed(this ModelBuilder builder)
 {
     builder.Entity <Account>().HasData(Seeder.Accounts());
     builder.Entity <Trade>().HasData(Seeder.Trades());
 }