protected DbAlterer(string connectionString, DbPlatform dbPlatform, DbAltererOptions options) { if (connectionString == null) throw new ArgumentNullException("connectionString"); if (dbPlatform == null) throw new ArgumentNullException("dbPlatform"); if (connectionString == null) throw new ArgumentNullException("connectionString"); Configuration = CreateRuntimeConfiguration(connectionString, dbPlatform, options); }
private RuntimeConfiguration CreateRuntimeConfiguration(string connectionString, DbPlatform dbPlatform, DbAltererOptions options) { var providerLocator = new ProviderLocator(new ProviderFactory()); // CLEAN: use DI container var providerInfo = providerLocator.GetLatest(dbPlatform); var validatorFactory = new ValidatorFactory(providerInfo, options, providerLocator); var validator = validatorFactory.Create(); var connectionInfo = new ConnectionInfo(connectionString, providerInfo.Metadata.InvariantName, providerInfo.Metadata.SupportsTransactions, providerInfo.Metadata.EnableAnsiQuotesCommand); var sqlDispatcher = new SqlDispatcher(options.GetScriptingOptions(), providerInfo.Provider, providerInfo.Metadata); return new RuntimeConfiguration(providerInfo, connectionInfo, validator, sqlDispatcher); }
protected DbAlterer(string connectionString, DbPlatform dbPlatform, DbAltererOptions options) { if (connectionString == null) { throw new ArgumentNullException("connectionString"); } if (dbPlatform == null) { throw new ArgumentNullException("dbPlatform"); } if (connectionString == null) { throw new ArgumentNullException("connectionString"); } Configuration = CreateRuntimeConfiguration(connectionString, dbPlatform, options); }
/// <summary> /// Initializes a new instance of <see cref="Migrator"/>. /// </summary> /// <param name="connectionString">Connection string to the database to be migrated.</param> /// <param name="dbPlatform"></param> /// <param name="options">Options.</param> public Migrator(string connectionString, DbPlatform dbPlatform, MigrationOptions options) : base(connectionString, dbPlatform, options) { if (connectionString == null) { throw new ArgumentNullException("connectionString"); } if (dbPlatform == null) { throw new ArgumentNullException("dbPlatform"); } if (options == null) { throw new ArgumentNullException("options"); } _options = options; }
internal bool IsWarningSuppressed(DbPlatform dbPlatform, DbType type, int?size, int?scale) { foreach (Suppression suppression in _warningSuppressions .Where(s => s.DbPlatform.Matches(dbPlatform) && s.Type == type)) { switch (suppression.Condition) { case SuppressCondition.WhenSpecifiedWithoutSize: if (!size.HasValue) { return(true); } break; case SuppressCondition.WhenSpecifiedWithSize: if (size.HasValue && !scale.HasValue) { return(true); } break; case SuppressCondition.WhenSpecifiedWithSizeAndScale: if (size.HasValue && scale.HasValue) { return(true); } break; case SuppressCondition.Always: return(true); default: continue; } } return(false); }
internal bool IsWarningSuppressed(DbPlatform dbPlatform, DbType type, int? size, int? scale) { foreach (Suppression suppression in _warningSuppressions .Where(s => s.DbPlatform.Matches(dbPlatform) && s.Type == type)) { switch (suppression.Condition) { case SuppressCondition.WhenSpecifiedWithoutSize: if (!size.HasValue) return true; break; case SuppressCondition.WhenSpecifiedWithSize: if (size.HasValue && !scale.HasValue) return true; break; case SuppressCondition.WhenSpecifiedWithSizeAndScale: if (size.HasValue && scale.HasValue) return true; break; case SuppressCondition.Always: return true; default: continue; } } return false; }
/// <summary> /// Initializes a new instance of <see cref="Migrator"/> with default options. /// </summary> /// <param name="connectionString">Connection string to the database to be migrated.</param> /// <param name="dbPlatform"></param> public Migrator(string connectionString, DbPlatform dbPlatform) : // signature used in a Wiki example this(connectionString, dbPlatform, new MigrationOptions()) { }
/// <summary> /// Initializes a new instance of <see cref="Migrator"/> for a specific module. /// </summary> /// <param name="connectionString">Connection string to the database to be migrated.</param> /// <param name="dbPlatform"></param> /// <param name="moduleName">The name of the module whose migrations should be executed.</param> public Migrator(string connectionString, DbPlatform dbPlatform, string moduleName) : this(connectionString, dbPlatform, new MigrationOptions(moduleName)) { }
internal bool Matches(DbPlatform dbPlatform) { return(Platform == dbPlatform.Platform && MajorVersion == dbPlatform.MajorVersion && Driver == dbPlatform.Driver); }
/// <summary> /// Initializes a new instance of <see cref="DbSchema"/> with default options. /// </summary> /// <param name="connectionString"></param> /// <param name="dbPlatform"></param> public DbSchema(string connectionString, DbPlatform dbPlatform) : this(connectionString, dbPlatform, new DbAltererOptions()) { }
/// <summary> /// Suppresses validation warnings for <paramref name="dbPlatform"/> and the data type <paramref name="type"/> under the <paramref name="condition"/>. /// </summary> public void SuppressWarning(DbPlatform dbPlatform, DbType type, SuppressCondition condition) { _warningSuppressions.Add(new Suppression(dbPlatform, type, condition)); }
internal bool Matches(DbPlatform dbPlatform) { return Platform == dbPlatform.Platform && MajorVersion == dbPlatform.MajorVersion && Driver == dbPlatform.Driver; }
private RuntimeConfiguration CreateRuntimeConfiguration(string connectionString, DbPlatform dbPlatform, DbAltererOptions options) { var providerLocator = new ProviderLocator(new ProviderFactory()); // CLEAN: use DI container var providerInfo = providerLocator.GetLatest(dbPlatform); var validatorFactory = new ValidatorFactory(providerInfo, options, providerLocator); var validator = validatorFactory.Create(); var connectionInfo = new ConnectionInfo(connectionString, providerInfo.Metadata.InvariantName, providerInfo.Metadata.SupportsTransactions, providerInfo.Metadata.EnableAnsiQuotesCommand); var sqlDispatcher = new SqlDispatcher(options.GetScriptingOptions(), providerInfo.Provider, providerInfo.Metadata); return(new RuntimeConfiguration(providerInfo, connectionInfo, validator, sqlDispatcher)); }
/// <summary> /// Suppresses validation warnings for <paramref name="dbPlatform"/> and the data type <paramref name="type"/> under the <paramref name="condition"/>. /// </summary> public void SuppressWarning(DbPlatform dbPlatform, DbType type, SuppressCondition condition) { _warningSuppressions.Add(new Suppression(dbPlatform, type, condition)); }
public Suppression(DbPlatform dbPlatform, DbType type, SuppressCondition condition) { _dbPlatform = dbPlatform; _type = type; _condition = condition; }
public Suppression(DbPlatform dbPlatform, DbType type, SuppressCondition condition) { _dbPlatform = dbPlatform; _type = type; _condition = condition; }
/// <summary> /// Initializes a new instance of <see cref="DbSchema"/>. /// </summary> /// <param name="connectionString"></param> /// <param name="dbPlatform"></param> /// <param name="options"></param> public DbSchema(string connectionString, DbPlatform dbPlatform, DbAltererOptions options) : base(connectionString, dbPlatform, options) { }
/// <summary> /// Initializes a new instance of <see cref="DbSchema"/> with default options. /// </summary> /// <param name="connectionString"></param> /// <param name="dbPlatform"></param> public DbSchema(string connectionString, DbPlatform dbPlatform) : this(connectionString, dbPlatform, new DbAltererOptions()) { }
/// <summary> /// Initializes a new instance of <see cref="DbSchema"/>. /// </summary> /// <param name="connectionString"></param> /// <param name="dbPlatform"></param> /// <param name="options"></param> public DbSchema(string connectionString, DbPlatform dbPlatform, DbAltererOptions options) : base(connectionString, dbPlatform, options) { }