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>(_sqlCommandBuilder, _sqlGenerator, generatorState, connection); } if (type == typeof(int)) { return new SqlServerSequenceHiLoValueGenerator<int>(_sqlCommandBuilder, _sqlGenerator, generatorState, connection); } if (type == typeof(short)) { return new SqlServerSequenceHiLoValueGenerator<short>(_sqlCommandBuilder, _sqlGenerator, generatorState, connection); } if (type == typeof(byte)) { return new SqlServerSequenceHiLoValueGenerator<byte>(_sqlCommandBuilder, _sqlGenerator, generatorState, connection); } if (type == typeof(char)) { return new SqlServerSequenceHiLoValueGenerator<char>(_sqlCommandBuilder, _sqlGenerator, generatorState, connection); } if (type == typeof(ulong)) { return new SqlServerSequenceHiLoValueGenerator<ulong>(_sqlCommandBuilder, _sqlGenerator, generatorState, connection); } if (type == typeof(uint)) { return new SqlServerSequenceHiLoValueGenerator<uint>(_sqlCommandBuilder, _sqlGenerator, generatorState, connection); } if (type == typeof(ushort)) { return new SqlServerSequenceHiLoValueGenerator<ushort>(_sqlCommandBuilder, _sqlGenerator, generatorState, connection); } if (type == typeof(sbyte)) { return new SqlServerSequenceHiLoValueGenerator<sbyte>(_sqlCommandBuilder, _sqlGenerator, generatorState, connection); } throw new ArgumentException(CoreStrings.InvalidValueGeneratorFactoryProperty( nameof(SqlServerSequenceValueGeneratorFactory), property.Name, property.DeclaringEntityType.DisplayName())); }
public SqlServerSequenceHiLoValueGenerator( [NotNull] ISqlCommandBuilder sqlCommandBuilder, [NotNull] ISqlServerUpdateSqlGenerator sqlGenerator, [NotNull] SqlServerSequenceValueGeneratorState generatorState, [NotNull] ISqlServerConnection connection) : base(generatorState) { Check.NotNull(sqlCommandBuilder, nameof(sqlCommandBuilder)); Check.NotNull(sqlGenerator, nameof(sqlGenerator)); Check.NotNull(connection, nameof(connection)); _sequence = generatorState.Sequence; _sqlCommandBuilder = sqlCommandBuilder; _sqlGenerator = sqlGenerator; _connection = connection; }
public SqlServerSequenceHiLoValueGenerator( [NotNull] ISqlStatementExecutor executor, [NotNull] ISqlServerUpdateSqlGenerator sqlGenerator, [NotNull] SqlServerSequenceValueGeneratorState generatorState, [NotNull] ISqlServerConnection connection) : base(generatorState) { Check.NotNull(executor, nameof(executor)); Check.NotNull(sqlGenerator, nameof(sqlGenerator)); Check.NotNull(connection, nameof(connection)); _sequence = generatorState.Sequence; _executor = executor; _sqlGenerator = sqlGenerator; _connection = connection; }