/// <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, IDiagnosticsLogger <DbLoggerCategory.Database.Command> commandLogger) : base(generatorState) { _sequence = generatorState.Sequence; _rawSqlCommandBuilder = rawSqlCommandBuilder; _sqlGenerator = sqlGenerator; _connection = connection; _commandLogger = commandLogger; }
/// <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 SqlServerSequenceHiLoValueGenerator( [NotNull] IRawSqlCommandBuilder rawSqlCommandBuilder, [NotNull] ISqlServerUpdateSqlGenerator sqlGenerator, [NotNull] SqlServerSequenceValueGeneratorState generatorState, [NotNull] ISqlServerConnection connection) : base(generatorState) { Check.NotNull(rawSqlCommandBuilder, nameof(rawSqlCommandBuilder)); Check.NotNull(sqlGenerator, nameof(sqlGenerator)); Check.NotNull(connection, nameof(connection)); _sequence = generatorState.Sequence; _rawSqlCommandBuilder = rawSqlCommandBuilder; _sqlGenerator = sqlGenerator; _connection = connection; }
/// <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 virtual ValueGenerator Create( IProperty property, SqlServerSequenceValueGeneratorState generatorState, ISqlServerConnection connection, IRawSqlCommandBuilder rawSqlCommandBuilder, IDiagnosticsLogger <DbLoggerCategory.Database.Command> commandLogger) { var type = property.ClrType.UnwrapNullableType().UnwrapEnumType(); if (type == typeof(long)) { return(new SqlServerSequenceHiLoValueGenerator <long>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(int)) { return(new SqlServerSequenceHiLoValueGenerator <int>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(decimal)) { return(new SqlServerSequenceHiLoValueGenerator <decimal>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(short)) { return(new SqlServerSequenceHiLoValueGenerator <short>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(byte)) { return(new SqlServerSequenceHiLoValueGenerator <byte>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(char)) { return(new SqlServerSequenceHiLoValueGenerator <char>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(ulong)) { return(new SqlServerSequenceHiLoValueGenerator <ulong>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(uint)) { return(new SqlServerSequenceHiLoValueGenerator <uint>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(ushort)) { return(new SqlServerSequenceHiLoValueGenerator <ushort>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } if (type == typeof(sbyte)) { return(new SqlServerSequenceHiLoValueGenerator <sbyte>(rawSqlCommandBuilder, _sqlGenerator, generatorState, connection, commandLogger)); } throw new ArgumentException( CoreStrings.InvalidValueGeneratorFactoryProperty( nameof(SqlServerSequenceValueGeneratorFactory), property.Name, property.DeclaringEntityType.DisplayName())); }
/// <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, SqlServerSequenceValueGeneratorState generatorState, ISqlServerConnection connection) { Check.NotNull(property, nameof(property)); Check.NotNull(generatorState, nameof(generatorState)); Check.NotNull(connection, nameof(connection)); var type = property.ClrType.UnwrapNullableType().UnwrapEnumType(); if (type == typeof(long)) { return(new SqlServerSequenceHiLoValueGenerator <long>(_rawSqlCommandBuilder, _sqlGenerator, generatorState, connection)); } if (type == typeof(int)) { return(new SqlServerSequenceHiLoValueGenerator <int>(_rawSqlCommandBuilder, _sqlGenerator, generatorState, connection)); } if (type == typeof(decimal)) { return(new SqlServerSequenceHiLoValueGenerator <decimal>(_rawSqlCommandBuilder, _sqlGenerator, generatorState, connection)); } if (type == typeof(short)) { return(new SqlServerSequenceHiLoValueGenerator <short>(_rawSqlCommandBuilder, _sqlGenerator, generatorState, connection)); } if (type == typeof(byte)) { return(new SqlServerSequenceHiLoValueGenerator <byte>(_rawSqlCommandBuilder, _sqlGenerator, generatorState, connection)); } if (type == typeof(char)) { return(new SqlServerSequenceHiLoValueGenerator <char>(_rawSqlCommandBuilder, _sqlGenerator, generatorState, connection)); } if (type == typeof(ulong)) { return(new SqlServerSequenceHiLoValueGenerator <ulong>(_rawSqlCommandBuilder, _sqlGenerator, generatorState, connection)); } if (type == typeof(uint)) { return(new SqlServerSequenceHiLoValueGenerator <uint>(_rawSqlCommandBuilder, _sqlGenerator, generatorState, connection)); } if (type == typeof(ushort)) { return(new SqlServerSequenceHiLoValueGenerator <ushort>(_rawSqlCommandBuilder, _sqlGenerator, generatorState, connection)); } if (type == typeof(sbyte)) { return(new SqlServerSequenceHiLoValueGenerator <sbyte>(_rawSqlCommandBuilder, _sqlGenerator, generatorState, connection)); } throw new ArgumentException( CoreStrings.InvalidValueGeneratorFactoryProperty( nameof(SqlServerSequenceValueGeneratorFactory), property.Name, property.DeclaringEntityType.DisplayName())); }