Table of Contents

Class ConnectionOptions

Namespace
LinqToDB.Data
Assembly
linq2db.dll
public sealed record ConnectionOptions : IOptionSet, IConfigurationID, IEquatable<ConnectionOptions>
Inheritance
ConnectionOptions
Implements
Extension Methods

Constructors

ConnectionOptions()

public ConnectionOptions()

ConnectionOptions(string?, string?, IDataProvider?, string?, MappingSchema?, DbConnection?, DbTransaction?, bool, Func<DataOptions, DbConnection>?, Func<ConnectionOptions, IDataProvider>?, ConnectionOptionsConnectionInterceptor?, Action<MappingSchema, IEntityChangeDescriptor>?)

public ConnectionOptions(string? ConfigurationString = null, string? ConnectionString = null, IDataProvider? DataProvider = null, string? ProviderName = null, MappingSchema? MappingSchema = null, DbConnection? DbConnection = null, DbTransaction? DbTransaction = null, bool DisposeConnection = false, Func<DataOptions, DbConnection>? ConnectionFactory = null, Func<ConnectionOptions, IDataProvider>? DataProviderFactory = null, ConnectionOptionsConnectionInterceptor? ConnectionInterceptor = null, Action<MappingSchema, IEntityChangeDescriptor>? OnEntityDescriptorCreated = null)

Parameters

ConfigurationString string

Gets configuration string name to use with DataConnection instance.

ConnectionString string

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

DataProvider IDataProvider

Gets optional IDataProvider implementation to use with connection.

ProviderName string

Gets optional provider name to use with DataConnection instance.

MappingSchema MappingSchema

Gets optional MappingSchema instance to use with DataConnection instance.

DbConnection DbConnection

Gets optional DbConnection instance to use with DataConnection instance.

DbTransaction DbTransaction

Gets optional DbTransaction instance to use with DataConnection instance.

DisposeConnection bool

Gets DbConnection ownership status for DataConnection instance. If true, DataConnection will dispose provided connection on own dispose.

ConnectionFactory Func<DataOptions, DbConnection>

Gets connection factory to use with DataConnection instance. Accepts current context DataOptions settings.

DataProviderFactory Func<ConnectionOptions, IDataProvider>

Gets IDataProvider factory to use with DataConnection instance.

ConnectionInterceptor ConnectionOptionsConnectionInterceptor

Connection interceptor to support connection configuration before or right after connection opened.

OnEntityDescriptorCreated Action<MappingSchema, IEntityChangeDescriptor>

Action, called on entity descriptor creation. Allows descriptor modification. When not specified, application-wide callback EntityDescriptorCreatedCallback called.

Properties

ConfigurationString

Gets configuration string name to use with DataConnection instance.

public string? ConfigurationString { get; init; }

Property Value

string

ConnectionFactory

Gets connection factory to use with DataConnection instance. Accepts current context DataOptions settings.

public Func<DataOptions, DbConnection>? ConnectionFactory { get; init; }

Property Value

Func<DataOptions, DbConnection>

ConnectionInterceptor

Connection interceptor to support connection configuration before or right after connection opened.

public ConnectionOptionsConnectionInterceptor? ConnectionInterceptor { get; init; }

Property Value

ConnectionOptionsConnectionInterceptor

ConnectionString

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

public string? ConnectionString { get; init; }

Property Value

string

DataProvider

Gets optional IDataProvider implementation to use with connection.

public IDataProvider? DataProvider { get; init; }

Property Value

IDataProvider

DataProviderFactory

Gets IDataProvider factory to use with DataConnection instance.

public Func<ConnectionOptions, IDataProvider>? DataProviderFactory { get; init; }

Property Value

Func<ConnectionOptions, IDataProvider>

DbConnection

Gets optional DbConnection instance to use with DataConnection instance.

public DbConnection? DbConnection { get; init; }

Property Value

DbConnection

DbTransaction

Gets optional DbTransaction instance to use with DataConnection instance.

public DbTransaction? DbTransaction { get; init; }

Property Value

DbTransaction

DisposeConnection

Gets DbConnection ownership status for DataConnection instance. If true, DataConnection will dispose provided connection on own dispose.

public bool DisposeConnection { get; init; }

Property Value

bool

MappingSchema

Gets optional MappingSchema instance to use with DataConnection instance.

public MappingSchema? MappingSchema { get; init; }

Property Value

MappingSchema

OnEntityDescriptorCreated

Action, called on entity descriptor creation. Allows descriptor modification. When not specified, application-wide callback EntityDescriptorCreatedCallback called.

public Action<MappingSchema, IEntityChangeDescriptor>? OnEntityDescriptorCreated { get; init; }

Property Value

Action<MappingSchema, IEntityChangeDescriptor>

ProviderName

Gets optional provider name to use with DataConnection instance.

public string? ProviderName { get; init; }

Property Value

string

Methods

Equals(ConnectionOptions?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ConnectionOptions? other)

Parameters

other ConnectionOptions

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

GetHashCode()

Serves as a hash function for a particular type.

public override int GetHashCode()

Returns

int

A hash code for the current object.