Table of Contents

Class NpgsqlOptionsExtension

Namespace
Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure.Internal
Assembly
Npgsql.EntityFrameworkCore.PostgreSQL.dll

Represents options managed by the Npgsql.

public class NpgsqlOptionsExtension : RelationalOptionsExtension, IDbContextOptionsExtension
Inheritance
NpgsqlOptionsExtension
Implements
Inherited Members

Constructors

NpgsqlOptionsExtension()

Initializes an instance of NpgsqlOptionsExtension with the default settings.

public NpgsqlOptionsExtension()

NpgsqlOptionsExtension(NpgsqlOptionsExtension)

Initializes an instance of NpgsqlOptionsExtension by copying the specified instance.

public NpgsqlOptionsExtension(NpgsqlOptionsExtension copyFrom)

Parameters

copyFrom NpgsqlOptionsExtension

The instance to copy.

Fields

DefaultPostgresVersion

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.

public static readonly Version DefaultPostgresVersion

Field Value

Version

Properties

AdminDatabase

The name of the database for administrative operations.

public virtual string? AdminDatabase { get; }

Property Value

string

DataSource

The DbDataSource, or null if a connection string or DbConnection was used instead of a DbDataSource.

public virtual DbDataSource? DataSource { get; }

Property Value

DbDataSource

Info

Information/metadata about the extension.

public override DbContextOptionsExtensionInfo Info { get; }

Property Value

DbContextOptionsExtensionInfo

IsPostgresVersionSet

The backend version to target, but returns null unless the user explicitly specified a version.

public virtual bool IsPostgresVersionSet { get; }

Property Value

bool

MinBatchSize

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.

public override int? MinBatchSize { get; }

Property Value

int?

PostgresVersion

The backend version to target.

public virtual Version PostgresVersion { get; }

Property Value

Version

ProvideClientCertificatesCallback

public virtual ProvideClientCertificatesCallback? ProvideClientCertificatesCallback { get; }

Property Value

ProvideClientCertificatesCallback

ProvidePasswordCallback

The specified ProvidePasswordCallback.

public virtual ProvidePasswordCallback? ProvidePasswordCallback { get; }

Property Value

ProvidePasswordCallback

RemoteCertificateValidationCallback

public virtual RemoteCertificateValidationCallback? RemoteCertificateValidationCallback { get; }

Property Value

RemoteCertificateValidationCallback

ReverseNullOrdering

True if reverse null ordering is enabled; otherwise, false.

public virtual bool ReverseNullOrdering { get; }

Property Value

bool

UseRedshift

Whether to target Redshift.

public virtual bool UseRedshift { get; }

Property Value

bool

UserRangeDefinitions

The list of range mappings specified by the user.

public virtual IReadOnlyList<UserRangeDefinition> UserRangeDefinitions { get; }

Property Value

IReadOnlyList<UserRangeDefinition>

Methods

ApplyServices(IServiceCollection)

Adds the services required to make the selected options work. This is used when there is no external IServiceProvider and EF is maintaining its own service provider internally. This allows database providers (and other extensions) to register their required services when EF is creating an service provider.

public override void ApplyServices(IServiceCollection services)

Parameters

services IServiceCollection

The collection to add services to.

Clone()

Override this method in a derived class to ensure that any clone created is also of that class.

protected override RelationalOptionsExtension Clone()

Returns

RelationalOptionsExtension

A clone of this instance, which can be modified before being returned as immutable.

Validate(IDbContextOptions)

Gives the extension a chance to validate that all options in the extension are valid. Most extensions do not have invalid combinations and so this will be a no-op. If options are invalid, then an exception should be thrown.

public override void Validate(IDbContextOptions options)

Parameters

options IDbContextOptions

The options being validated.

WithAdminDatabase(string?)

Returns a copy of the current instance configured to use the specified administrative database.

public virtual NpgsqlOptionsExtension WithAdminDatabase(string? adminDatabase)

Parameters

adminDatabase string

The name of the database for administrative operations.

Returns

NpgsqlOptionsExtension

WithConnection(DbConnection?)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

public override RelationalOptionsExtension WithConnection(DbConnection? connection)

Parameters

connection DbConnection

The option to change.

Returns

RelationalOptionsExtension

A new instance with the option changed.

WithConnectionString(string?)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

public override RelationalOptionsExtension WithConnectionString(string? connectionString)

Parameters

connectionString string

The option to change.

Returns

RelationalOptionsExtension

A new instance with the option changed.

WithDataSource(DbDataSource?)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

public virtual RelationalOptionsExtension WithDataSource(DbDataSource? dataSource)

Parameters

dataSource DbDataSource

The option to change.

Returns

RelationalOptionsExtension

A new instance with the option changed.

WithPostgresVersion(Version?)

Returns a copy of the current instance with the specified PostgreSQL version.

public virtual NpgsqlOptionsExtension WithPostgresVersion(Version? postgresVersion)

Parameters

postgresVersion Version

The backend version to target.

Returns

NpgsqlOptionsExtension

A copy of the current instance with the specified PostgreSQL version.

WithProvideClientCertificatesCallback(ProvideClientCertificatesCallback?)

Returns a copy of the current instance with the specified ProvideClientCertificatesCallback.

public virtual NpgsqlOptionsExtension WithProvideClientCertificatesCallback(ProvideClientCertificatesCallback? callback)

Parameters

callback ProvideClientCertificatesCallback

The specified callback.

Returns

NpgsqlOptionsExtension

WithProvidePasswordCallback(ProvidePasswordCallback?)

Returns a copy of the current instance with the specified ProvidePasswordCallback.

public virtual NpgsqlOptionsExtension WithProvidePasswordCallback(ProvidePasswordCallback? callback)

Parameters

callback ProvidePasswordCallback

The specified callback.

Returns

NpgsqlOptionsExtension

WithRedshift(bool)

Returns a copy of the current instance with the specified Redshift settings.

public virtual NpgsqlOptionsExtension WithRedshift(bool useRedshift)

Parameters

useRedshift bool

Whether to target Redshift.

Returns

NpgsqlOptionsExtension

A copy of the current instance with the specified Redshift setting.

WithRemoteCertificateValidationCallback(RemoteCertificateValidationCallback?)

Returns a copy of the current instance with the specified RemoteCertificateValidationCallback.

public virtual NpgsqlOptionsExtension WithRemoteCertificateValidationCallback(RemoteCertificateValidationCallback? callback)

Parameters

callback RemoteCertificateValidationCallback

The specified callback.

Returns

NpgsqlOptionsExtension

WithUserRangeDefinition(string, string?, Type, string?)

Returns a copy of the current instance configured with the specified range mapping.

public virtual NpgsqlOptionsExtension WithUserRangeDefinition(string rangeName, string? schemaName, Type subtypeClrType, string? subtypeName)

Parameters

rangeName string
schemaName string
subtypeClrType Type
subtypeName string

Returns

NpgsqlOptionsExtension

WithUserRangeDefinition<TSubtype>(string, string?, string?)

Returns a copy of the current instance configured with the specified range mapping.

public virtual NpgsqlOptionsExtension WithUserRangeDefinition<TSubtype>(string rangeName, string? schemaName = null, string? subtypeName = null)

Parameters

rangeName string
schemaName string
subtypeName string

Returns

NpgsqlOptionsExtension

Type Parameters

TSubtype