Class NpgsqlOptionsExtension
- 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
NpgsqlOptionsExtensionThe 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
Properties
AdminDatabase
The name of the database for administrative operations.
public virtual string? AdminDatabase { get; }
Property Value
DataSource
The DbDataSource, or null if a connection string or DbConnection was used instead of a DbDataSource.
public virtual DbDataSource? DataSource { get; }
Property Value
Info
Information/metadata about the extension.
public override DbContextOptionsExtensionInfo Info { get; }
Property Value
IsPostgresVersionSet
The backend version to target, but returns null unless the user explicitly specified a version.
public virtual bool IsPostgresVersionSet { get; }
Property Value
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
ProvideClientCertificatesCallback
The specified ProvideClientCertificatesCallback.
public virtual ProvideClientCertificatesCallback? ProvideClientCertificatesCallback { get; }
Property Value
ProvidePasswordCallback
The specified ProvidePasswordCallback.
public virtual ProvidePasswordCallback? ProvidePasswordCallback { get; }
Property Value
RemoteCertificateValidationCallback
The specified RemoteCertificateValidationCallback.
public virtual RemoteCertificateValidationCallback? RemoteCertificateValidationCallback { get; }
Property Value
ReverseNullOrdering
True if reverse null ordering is enabled; otherwise, false.
public virtual bool ReverseNullOrdering { get; }
Property Value
UseRedshift
Whether to target Redshift.
public virtual bool UseRedshift { get; }
Property Value
UserRangeDefinitions
The list of range mappings specified by the user.
public virtual IReadOnlyList<UserRangeDefinition> UserRangeDefinitions { get; }
Property Value
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
IServiceCollectionThe 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
IDbContextOptionsThe 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
stringThe name of the database for administrative operations.
Returns
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
DbConnectionThe 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
stringThe 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
DbDataSourceThe 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
VersionThe 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
ProvideClientCertificatesCallbackThe specified callback.
Returns
WithProvidePasswordCallback(ProvidePasswordCallback?)
Returns a copy of the current instance with the specified ProvidePasswordCallback.
public virtual NpgsqlOptionsExtension WithProvidePasswordCallback(ProvidePasswordCallback? callback)
Parameters
callback
ProvidePasswordCallbackThe specified callback.
Returns
WithRedshift(bool)
Returns a copy of the current instance with the specified Redshift settings.
public virtual NpgsqlOptionsExtension WithRedshift(bool useRedshift)
Parameters
useRedshift
boolWhether 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
RemoteCertificateValidationCallbackThe specified callback.
Returns
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
Returns
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
Returns
Type Parameters
TSubtype