Example #1
0
 public NpgsqlDatabase(
     [NotNull] DbContext context,
     [NotNull] INpgsqlDataStoreCreator dataStoreCreator,
     [NotNull] INpgsqlEFConnection connection,
     [NotNull] Migrator migrator,
     [NotNull] ILoggerFactory loggerFactory)
     : base(context, dataStoreCreator, connection, migrator, loggerFactory)
 {
 }
Example #2
0
 public NpgsqlQueryContextFactory(
     [NotNull] IStateManager stateManager,
     [NotNull] IEntityKeyFactorySource entityKeyFactorySource,
     [NotNull] IClrCollectionAccessorSource collectionAccessorSource,
     [NotNull] IClrAccessorSource <IClrPropertySetter> propertySetterSource,
     [NotNull] INpgsqlEFConnection connection,
     [NotNull] ILoggerFactory loggerFactory)
     : base(stateManager, entityKeyFactorySource, collectionAccessorSource, propertySetterSource, connection, loggerFactory)
 {
 }
Example #3
0
        public virtual ValueGenerator Create(
            [NotNull] IProperty property,
            [NotNull] NpgsqlSequenceValueGeneratorState generatorState,
            [NotNull] INpgsqlEFConnection connection)
        {
            Check.NotNull(property, nameof(property));
            Check.NotNull(generatorState, nameof(generatorState));
            Check.NotNull(connection, nameof(connection));

            if (property.ClrType.UnwrapNullableType() == typeof(long))
            {
                return(new NpgsqlSequenceValueGenerator <long>(_executor, generatorState, connection));
            }

            if (property.ClrType.UnwrapNullableType() == typeof(int))
            {
                return(new NpgsqlSequenceValueGenerator <int>(_executor, generatorState, connection));
            }

            if (property.ClrType.UnwrapNullableType() == typeof(short))
            {
                return(new NpgsqlSequenceValueGenerator <short>(_executor, generatorState, connection));
            }

            if (property.ClrType.UnwrapNullableType() == typeof(byte))
            {
                return(new NpgsqlSequenceValueGenerator <byte>(_executor, generatorState, connection));
            }

            if (property.ClrType.UnwrapNullableType() == typeof(ulong))
            {
                return(new NpgsqlSequenceValueGenerator <ulong>(_executor, generatorState, connection));
            }

            if (property.ClrType.UnwrapNullableType() == typeof(uint))
            {
                return(new NpgsqlSequenceValueGenerator <uint>(_executor, generatorState, connection));
            }

            if (property.ClrType.UnwrapNullableType() == typeof(ushort))
            {
                return(new NpgsqlSequenceValueGenerator <ushort>(_executor, generatorState, connection));
            }

            if (property.ClrType.UnwrapNullableType() == typeof(sbyte))
            {
                return(new NpgsqlSequenceValueGenerator <sbyte>(_executor, generatorState, connection));
            }

            throw new ArgumentException(Microsoft.Data.Entity.Internal.Strings.InvalidValueGeneratorFactoryProperty(
                                            nameof(NpgsqlSequenceValueGeneratorFactory), property.Name, property.EntityType.DisplayName()));
        }
Example #4
0
        public NpgsqlValueGeneratorSelector(
            [NotNull] INpgsqlValueGeneratorCache cache,
            [NotNull] NpgsqlSequenceValueGeneratorFactory sequenceFactory,
            [NotNull] INpgsqlEFConnection connection)
        {
            Check.NotNull(cache, nameof(cache));
            Check.NotNull(sequenceFactory, nameof(sequenceFactory));
            Check.NotNull(connection, nameof(connection));

            _cache           = cache;
            _sequenceFactory = sequenceFactory;
            _connection      = connection;
        }
        public NpgsqlValueGeneratorSelector(
            [NotNull] INpgsqlValueGeneratorCache cache,
            [NotNull] INpgsqlSequenceValueGeneratorFactory sequenceFactory,
            [NotNull] INpgsqlEFConnection connection)
        {
            Check.NotNull(cache, nameof(cache));
            Check.NotNull(sequenceFactory, nameof(sequenceFactory));
            Check.NotNull(connection, nameof(connection));

            _cache = cache;
            _sequenceFactory = sequenceFactory;
            _connection = connection;
        }
Example #6
0
        public NpgsqlSequenceValueGenerator(
            [NotNull] SqlStatementExecutor executor,
            [NotNull] NpgsqlSequenceValueGeneratorState generatorState,
            [NotNull] INpgsqlEFConnection connection)
            : base(generatorState)
        {
            Check.NotNull(executor, nameof(executor));
            Check.NotNull(generatorState, nameof(generatorState));
            Check.NotNull(connection, nameof(connection));

            _sequenceName = generatorState.SequenceName;
            _executor     = executor;
            _connection   = connection;
        }
        public virtual ValueGenerator Create(IProperty property, NpgsqlSequenceValueGeneratorState generatorState, INpgsqlEFConnection connection)
        {
            Check.NotNull(property, nameof(property));
            Check.NotNull(generatorState, nameof(generatorState));
            Check.NotNull(connection, nameof(connection));

            if (property.ClrType.UnwrapNullableType() == typeof(long))
            {
                return new NpgsqlSequenceValueGenerator<long>(_executor, _sqlGenerator, generatorState, connection);
            }

            if (property.ClrType.UnwrapNullableType() == typeof(int))
            {
                return new NpgsqlSequenceValueGenerator<int>(_executor, _sqlGenerator, generatorState, connection);
            }

            if (property.ClrType.UnwrapNullableType() == typeof(short))
            {
                return new NpgsqlSequenceValueGenerator<short>(_executor, _sqlGenerator, generatorState, connection);
            }

            if (property.ClrType.UnwrapNullableType() == typeof(byte))
            {
                return new NpgsqlSequenceValueGenerator<byte>(_executor, _sqlGenerator, generatorState, connection);
            }

            if (property.ClrType.UnwrapNullableType() == typeof(ulong))
            {
                return new NpgsqlSequenceValueGenerator<ulong>(_executor, _sqlGenerator, generatorState, connection);
            }

            if (property.ClrType.UnwrapNullableType() == typeof(uint))
            {
                return new NpgsqlSequenceValueGenerator<uint>(_executor, _sqlGenerator, generatorState, connection);
            }

            if (property.ClrType.UnwrapNullableType() == typeof(ushort))
            {
                return new NpgsqlSequenceValueGenerator<ushort>(_executor, _sqlGenerator, generatorState, connection);
            }

            if (property.ClrType.UnwrapNullableType() == typeof(sbyte))
            {
                return new NpgsqlSequenceValueGenerator<sbyte>(_executor, _sqlGenerator, generatorState, connection);
            }

            throw new ArgumentException(Microsoft.Data.Entity.Internal.Strings.InvalidValueGeneratorFactoryProperty(
                nameof(NpgsqlSequenceValueGeneratorFactory), property.Name, property.EntityType.DisplayName()));
        }
        public NpgsqlDataStoreCreator(
            [NotNull] INpgsqlEFConnection connection,
            [NotNull] INpgsqlModelDiffer modelDiffer,
            [NotNull] INpgsqlMigrationSqlGenerator sqlGenerator,
            [NotNull] ISqlStatementExecutor statementExecutor)
        {
            Check.NotNull(connection, nameof(connection));
            Check.NotNull(modelDiffer, nameof(modelDiffer));
            Check.NotNull(sqlGenerator, nameof(sqlGenerator));
            Check.NotNull(statementExecutor, nameof(statementExecutor));

            _connection        = connection;
            _modelDiffer       = modelDiffer;
            _sqlGenerator      = sqlGenerator;
            _statementExecutor = statementExecutor;
        }
        public NpgsqlHistoryRepository(
            [NotNull] INpgsqlEFConnection connection,
            [NotNull] INpgsqlDataStoreCreator creator,
            [NotNull] DbContext context,
            [NotNull] INpgsqlSqlGenerator sqlGenerator)
        {
            Check.NotNull(connection, nameof(connection));
            Check.NotNull(creator, nameof(creator));
            Check.NotNull(context, nameof(context));
            Check.NotNull(sqlGenerator, nameof(sqlGenerator));

            _connection  = connection;
            _creator     = creator;
            _contextType = context.GetType();
            _sql         = sqlGenerator;
        }
Example #10
0
        public NpgsqlHistoryRepository(
            [NotNull] INpgsqlEFConnection connection,
            [NotNull] INpgsqlDataStoreCreator creator,
            [NotNull] DbContext context,
            [NotNull] INpgsqlSqlGenerator sqlGenerator)
        {
            Check.NotNull(connection, nameof(connection));
            Check.NotNull(creator, nameof(creator));
            Check.NotNull(context, nameof(context));
            Check.NotNull(sqlGenerator, nameof(sqlGenerator));

            _connection = connection;
            _creator = creator;
            _contextType = context.GetType();
            _sql = sqlGenerator;
        }
Example #11
0
        public NpgsqlDataStoreCreator(
            [NotNull] INpgsqlEFConnection connection,
            [NotNull] INpgsqlModelDiffer modelDiffer,
            [NotNull] INpgsqlMigrationSqlGenerator sqlGenerator,
            [NotNull] ISqlStatementExecutor statementExecutor)
        {
            Check.NotNull(connection, nameof(connection));
            Check.NotNull(modelDiffer, nameof(modelDiffer));
            Check.NotNull(sqlGenerator, nameof(sqlGenerator));
            Check.NotNull(statementExecutor, nameof(statementExecutor));

            _connection = connection;
            _modelDiffer = modelDiffer;
            _sqlGenerator = sqlGenerator;
            _statementExecutor = statementExecutor;
        }
Example #12
0
        public NpgsqlDatabaseFactory(
            [NotNull] DbContext context,
            [NotNull] INpgsqlDataStoreCreator dataStoreCreator,
            [NotNull] INpgsqlEFConnection connection,
            [NotNull] IMigrator migrator,
            [NotNull] ILoggerFactory loggerFactory)
        {
            Check.NotNull(context, nameof(context));
            Check.NotNull(dataStoreCreator, nameof(dataStoreCreator));
            Check.NotNull(connection, nameof(connection));
            Check.NotNull(migrator, nameof(migrator));
            Check.NotNull(loggerFactory, nameof(loggerFactory));

            _context = context;
            _dataStoreCreator = dataStoreCreator;
            _connection = connection;
            _migrator = migrator;
            _loggerFactory = loggerFactory;
        }
Example #13
0
        public NpgsqlDatabaseFactory(
            [NotNull] DbContext context,
            [NotNull] INpgsqlDataStoreCreator dataStoreCreator,
            [NotNull] INpgsqlEFConnection connection,
            [NotNull] Migrator migrator,
            [NotNull] ILoggerFactory loggerFactory)
        {
            Check.NotNull(context, nameof(context));
            Check.NotNull(dataStoreCreator, nameof(dataStoreCreator));
            Check.NotNull(connection, nameof(connection));
            Check.NotNull(migrator, nameof(migrator));
            Check.NotNull(loggerFactory, nameof(loggerFactory));

            _context          = context;
            _dataStoreCreator = dataStoreCreator;
            _connection       = connection;
            _migrator         = migrator;
            _loggerFactory    = loggerFactory;
        }
Example #14
0
 public NpgsqlDataStore(
     [NotNull] IModel model,
     [NotNull] IEntityKeyFactorySource entityKeyFactorySource,
     [NotNull] IEntityMaterializerSource entityMaterializerSource,
     [NotNull] INpgsqlEFConnection connection,
     [NotNull] NpgsqlCommandBatchPreparer batchPreparer,
     [NotNull] NpgsqlBatchExecutor batchExecutor,
     [NotNull] IDbContextOptions options,
     [NotNull] ILoggerFactory loggerFactory)
     : base(
         Check.NotNull(model, nameof(model)),
         Check.NotNull(entityKeyFactorySource, nameof(entityKeyFactorySource)),
         Check.NotNull(entityMaterializerSource, nameof(entityMaterializerSource)),
         Check.NotNull(connection, nameof(connection)),
         Check.NotNull(batchPreparer, nameof(batchPreparer)),
         Check.NotNull(batchExecutor, nameof(batchExecutor)),
         Check.NotNull(options, nameof(options)),
         Check.NotNull(loggerFactory, nameof(loggerFactory)))
 {
 }