/// <summary> /// Creates a new instance of AutoMigrator with given DbContext and settings. /// </summary> /// <param name="dbContext">DbContext to perform migration operations.</param> /// <param name="whitelistedSources">Insecure Data Sources to allow the AutoMigration process execute. EFCoreAutoMigrator will not execute any data source besides the ones that are provided in this list.</param> /// <param name="options">Configurations for database migration and hash storage operations.</param> /// <param name="logger">Logger for console or text outputs.</param> public AutoMigrator(DbContext dbContext, WhitelistedSource[] whitelistedSources, AutoMigratorOptions options = null, ILogger logger = null) { _logger = logger; _options = options ?? new AutoMigratorOptions(); _dbContext = dbContext ?? throw new ArgumentNullException("DbContext is required."); CheckDataSource(dbContext, whitelistedSources, false); }
/// <summary> /// Creates a new instance of AutoMigrator with given DbContext and settings. /// </summary> /// <param name="dbContext">DbContext to perform migration operations.</param> /// <param name="secureDataSources">Secure data sources to prevent accidental auto migrator initiations.</param> /// <param name="options">Configurations for database migration and hash storage operations.</param> /// <param name="logger">Logger for console or text outputs.</param> public AutoMigrator(DbContext dbContext, SecureDataSource[] secureDataSources, AutoMigratorOptions options = null, ILogger logger = null) { _logger = logger; _options = options ?? new AutoMigratorOptions(); _dbContext = dbContext ?? throw new ArgumentNullException("DbContext is required."); CheckSecureDataSources(dbContext, secureDataSources); }