/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public Migrator( IMigrationsAssembly migrationsAssembly, IHistoryRepository historyRepository, IDatabaseCreator databaseCreator, IMigrationsSqlGenerator migrationsSqlGenerator, IRawSqlCommandBuilder rawSqlCommandBuilder, IMigrationCommandExecutor migrationCommandExecutor, IRelationalConnection connection, ISqlGenerationHelper sqlGenerationHelper, ICurrentDbContext currentContext, IModelRuntimeInitializer modelRuntimeInitializer, IDiagnosticsLogger <DbLoggerCategory.Migrations> logger, IRelationalCommandDiagnosticsLogger commandLogger, IDatabaseProvider databaseProvider) { _migrationsAssembly = migrationsAssembly; _historyRepository = historyRepository; _databaseCreator = (IRelationalDatabaseCreator)databaseCreator; _migrationsSqlGenerator = migrationsSqlGenerator; _rawSqlCommandBuilder = rawSqlCommandBuilder; _migrationCommandExecutor = migrationCommandExecutor; _connection = connection; _sqlGenerationHelper = sqlGenerationHelper; _currentContext = currentContext; _modelRuntimeInitializer = modelRuntimeInitializer; _logger = logger; _commandLogger = commandLogger; _activeProvider = databaseProvider.Name; }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual ValueGenerator Create( IProperty property, NpgsqlSequenceValueGeneratorState generatorState, INpgsqlRelationalConnection connection, IRawSqlCommandBuilder rawSqlCommandBuilder, IRelationalCommandDiagnosticsLogger commandLogger) { var type = property.ClrType.UnwrapNullableType().UnwrapEnumType(); if (type == typeof(long)) { return(new NpgsqlSequenceHiLoValueGenerator <long>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(int)) { return(new NpgsqlSequenceHiLoValueGenerator <int>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(short)) { return(new NpgsqlSequenceHiLoValueGenerator <short>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(byte)) { return(new NpgsqlSequenceHiLoValueGenerator <byte>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(char)) { return(new NpgsqlSequenceHiLoValueGenerator <char>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(ulong)) { return(new NpgsqlSequenceHiLoValueGenerator <ulong>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(uint)) { return(new NpgsqlSequenceHiLoValueGenerator <uint>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(ushort)) { return(new NpgsqlSequenceHiLoValueGenerator <ushort>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(sbyte)) { return(new NpgsqlSequenceHiLoValueGenerator <sbyte>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } throw new ArgumentException(CoreStrings.InvalidValueGeneratorFactoryProperty( nameof(NpgsqlSequenceValueGeneratorFactory), property.Name, property.DeclaringEntityType.DisplayName())); }
/// <summary> /// Creates a new instance of the command. /// </summary> /// <param name="relationalCommand">The underlying <see cref="IRelationalCommand" /> that will be used to execute the command.</param> /// <param name="context">The current <see cref="DbContext" /> or null if not known.</param> /// <param name="logger">The command logger.</param> /// <param name="transactionSuppressed">Indicates whether or not transactions should be suppressed while executing the command.</param> public MigrationCommand( IRelationalCommand relationalCommand, DbContext?context, IRelationalCommandDiagnosticsLogger logger, bool transactionSuppressed = false) { _relationalCommand = relationalCommand; _context = context; CommandLogger = logger; TransactionSuppressed = transactionSuppressed; }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public SqlServerValueGeneratorSelector( ValueGeneratorSelectorDependencies dependencies, ISqlServerSequenceValueGeneratorFactory sequenceFactory, ISqlServerConnection connection, IRawSqlCommandBuilder rawSqlCommandBuilder, IRelationalCommandDiagnosticsLogger commandLogger) : base(dependencies) { _sequenceFactory = sequenceFactory; _connection = connection; _rawSqlCommandBuilder = rawSqlCommandBuilder; _commandLogger = commandLogger; }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public SqlServerSequenceHiLoValueGenerator( IRawSqlCommandBuilder rawSqlCommandBuilder, ISqlServerUpdateSqlGenerator sqlGenerator, SqlServerSequenceValueGeneratorState generatorState, ISqlServerConnection connection, IRelationalCommandDiagnosticsLogger commandLogger) : base(generatorState) { _sequence = generatorState.Sequence; _rawSqlCommandBuilder = rawSqlCommandBuilder; _sqlGenerator = sqlGenerator; _connection = connection; _commandLogger = commandLogger; }