public static void Initialize(IServiceProvider serviceProvider) { using (var context = new AvaliadorPIContext(serviceProvider.GetRequiredService <DbContextOptions <AvaliadorPIContext> >())) { if (context.Database.GetPendingMigrations().Any()) { context.Database.Migrate(); } context.SaveChanges(); } }
public bool Commit() { return(_context.SaveChanges() > 0); }