/// <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); }
/// <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()); }