public static void Seed(this DemofContext context, IWebHost host) { if (context.AllMigrationsApplied()) { var seed = new Seeder(host, context); seed.Seed(host); } }
public static bool AllMigrationsApplied(this DemofContext context) { var applied = context.GetService <IHistoryRepository>() .GetAppliedMigrations() .Select(m => m.MigrationId); var total = context.GetService <IMigrationsAssembly>() .Migrations .Select(m => m.Key); return(!total.Except(applied).Any()); }
public UserRepository(DemofContext context) : base(context) { }
public GenericRepository(DemofContext context) { _context = context; }
public Seeder(IWebHost host, DemofContext context) { this.context = context; }