DataOptionsExtensions
Configure connection to use Access default provider and connection string.
Configure connection to use Access ODBC provider.
Configure connection to use Access ODBC provider and connection string.
Configure connection to use Access OleDb provider.
Configure connection to use Access OleDb provider and connection string.
Sets custom actions, executed after connection opened.
Configure connection to use SAP/Sybase ASE default provider.
Configure connection to use SAP/Sybase ASE default provider and connection string.
Sets custom actions, executed before connection opened.
Enables database constrains enforcement during bulk copy operation.
Supported with
ProviderSpecific bulk copy mode for following databases:
OracleSQL ServerSAP/Sybase ASE
Gets or sets explicit name of target database instead of one, configured for copied entity in mapping schema.
See
DatabaseName<T> method for support information per provider.
Enables insert triggers during bulk copy operation.
Supported with
ProviderSpecific bulk copy mode for following databases:
OracleSQL ServerSAP/Sybase ASE
If this option set to true, bulk copy will use values of columns, marked with IsIdentity flag.
SkipOnInsert flag in this case will be ignored.
Otherwise those columns will be skipped and values will be generated by server.
Not compatible with
RowByRow mode.
Enables instert of
NULL values instead of values from colum default constraint during bulk copy operation.
Supported with
ProviderSpecific bulk copy mode for following databases:
SQL ServerSAP/Sybase ASE
Number of rows in each batch. At the end of each batch, the rows in the batch are sent to the server.
Returns an integer value or zero if no value has been set.
Implemented only by ClickHouse.Client provider. Defines number of connections, used for parallel insert in
ProviderSpecific mode.
If set, will override the Maximum parameters per batch statement from
MaxParameters.
Gets or sets counter after how many copied records
RowsCopiedCallback should be called.
E.g. if you set it to 10, callback will be called after each 10 copied records.
To disable callback, set this option to 0 (default value).
Gets or sets callback method that will be called by BulkCopy operation after each
NotifyAfter rows copied.
This callback will not be used if
NotifyAfter set to 0.
Gets or sets explicit name of target schema/owner instead of one, configured for copied entity in mapping schema.
See
SchemaName<T> method for support information per provider.
Gets or sets explicit name of target server instead of one, configured for copied entity in mapping schema.
See
ServerName<T> method for support information per provider.
Also note that it is not supported by provider-specific insert method.
Applies table lock during bulk copy operation.
Supported with
ProviderSpecific bulk copy mode for following databases:
DB2Informix (using DB2 provider)SQL ServerSAP/Sybase ASE
Gets or sets explicit name of target table instead of one, configured for copied entity in mapping schema.
Gets or sets
TableOptions flags overrides instead of configured for copied entity in mapping schema.
See
IsTemporary<T> method for support information per provider.
Number of seconds for the operation to complete before it times out.
Specify bulk copy implementation type.
Enables automatic transaction creation during bulk copy operation.
Supported with
ProviderSpecific bulk copy mode for following databases:
OracleSQL ServerSAP/Sybase ASE
Gets or sets whether to Always use Parameters for MultipleRowsCopy. Default is false.
If True, provider's override for
MaxParameters will be used to determine the maximum number of rows per insert,
Unless overridden by
MaxParametersForBatch.
Implemented only by ClickHouse.Client provider. When set, provider-specific bulk copy will use session-less connection even if called over connection with session.
Note that session-less connections cannot be used with session-bound functionality like temporary tables.
Specifies timeout when query will be evicted from cache since last execution of query.
Default value is 1 hour.
Configure connection to use UseClickHouse provider.
Configure connection to use UseClickHouse provider and connection string.
The coefficient for the exponential function used to compute the delay between retries, must be nonnegative.
Default value: 1 second.
If set to true nullable fields would be checked for IS NULL in Equal/NotEqual comparisons.
This affects: Equal, NotEqual, Not Contains
Default value: true.
Defines configuration sting to use with DataOptions.
Defines configuration sting and MappingSchema to use with DataOptions.
Defines configuration sting to use with DataOptions.
Defines configuration sting and MappingSchema to use with DataOptions.
Defines DbConnection to use with DataOptions.
Defines data provider and DbConnection to use with DataOptions.
Defines data provider and DbConnection to use with DataOptions.
Defines connection factory to use with DataOptions.
Defines data provider and connection factory to use with DataOptions.
Defines provider name and connection sting to use with DataOptions.
Defines data provider and connection sting to use with DataOptions.
Defines connection sting to use with DataOptions.
Defines data provider to use with DataOptions.
Sets DataProviderFactory option.
Configure connection to use DB2 default provider and connection string.
Configure connection to use specific DB2 provider.
Configure connection to use specific DB2 provider and connection string.
Uses default retry policy factory.
Used to disable LINQ expressions caching for queries.
This cache reduces time, required for query parsing but have several side-effects:
- cached LINQ expressions could contain references to external objects as parameters, which could lead to memory leaks if those objects are not used anymore by other code
- cache access synchronization could lead to bigger latencies than it saves.
Default value:
false.
It is not recommended to enable this option as it could lead to severe slowdown. Better approach will be
to call
ClearCache method to cleanup cache after queries, that produce severe memory leaks you need to fix.
More details.
Controls behavior, when LINQ query chain contains multiple
OrderBy<T, U> or
OrderByDescending<T, U> calls:
- if
true - non-first OrderBy* call will be treated as ThenBy* call;
- if
false - OrderBy* call will discard sort specifications, added by previous OrderBy* and ThenBy* calls.
Default value:
false.
If
true, user could add new mappings to context mapping schems (
MappingSchema).
Otherwise
LinqToDBException will be generated on locked mapping schema edit attempt.
It is not recommended to enable this option as it has performance implications.
Proper approach is to create single
MappingSchema instance once, configure mappings for it and use this
MappingSchema instance for all context instances.
The base for the exponential function used to compute the delay between retries, must be positive.
Default value: 2.
Retry policy factory method, used to create retry policy for new
DataConnection instance.
If factory method is not set, retry policy is not used.
Not set by default.
Configure connection to use Firebird provider.
Configure connection to use Firebird provider and connection string.
Enables generation of test class for each LINQ query, executed while this option is enabled.
This option could be useful for issue reporting, when you need to provide reproducible case.
Test file will be placed to
linq2db subfolder of temp folder and exact file path will be logged
to data connection tracing infrastructure.
See
TraceSwitch for more details.
Default value:
false.
Controls behavior of LINQ query, which ends with GroupBy call.
- if
true -
LinqToDBException will be thrown for such queries;
- if
false - behavior is controlled by
UsePreloadGroups option.
Default value:
true.
Controls behavior of linq2db when there is no updateable fields in Update query:
- if
true - query not executed and Update operation returns 0 as number of affected records;
- if
false -
LinqToDBException will be thrown.
Default value:
false.
Configure connection to use Informix default provider.
Configure connection to use Informix default provider and connection string.
Adds IInterceptor instance to those registered on the context.
Interceptors can be used to view, change, or suppress operations taken by linq2db.
See the specific implementations of IInterceptor for details. For example, 'ICommandInterceptor'.
Extensions can also register multiple IInterceptors in the internal service provider.
If both injected and application interceptors are found, then the injected interceptors are run in the
order that they are resolved from the service provider, and then the application interceptors are run
in the order that they were added to the context.
Calling this method multiple times will result in all interceptors in every call being added to the context.
Interceptors added in a previous call are not overridden by interceptors added in a later call.
Adds IInterceptor instances to those registered on the context.
Interceptors can be used to view, change, or suppress operations taken by linq2db.
See the specific implementations of IInterceptor for details. For example, 'ICommandInterceptor'.
A single interceptor instance can implement multiple different interceptor interfaces. I will be registered as
an interceptor for all interfaces that it implements.
Extensions can also register multiple IInterceptors in the internal service provider.
If both injected and application interceptors are found, then the injected interceptors are run in the
order that they are resolved from the service provider, and then the application interceptors are run
in the order that they were added to the context.
Calling this method multiple times will result in all interceptors in every call being added to the context.
Interceptors added in a previous call are not overridden by interceptors added in a later call.
Adds IInterceptor instances to those registered on the context.
Interceptors can be used to view, change, or suppress operations taken by linq2db.
See the specific implementations of IInterceptor for details. For example, 'ICommandInterceptor'.
Extensions can also register multiple IInterceptors in the internal service provider.
If both injected and application interceptors are found, then the injected interceptors are run in the
order that they are resolved from the service provider, and then the application interceptors are run
in the order that they were added to the context.
Calling this method multiple times will result in all interceptors in every call being added to the context.
Interceptors added in a previous call are not overridden by interceptors added in a later call.
Allows SQL generation to automatically transform
SELECT DISTINCT value FROM Table ORDER BY date
Into GROUP BY equivalent if syntax is not supported
Default value: true.
Defines mapping schema to use with DataOptions.
The maximum time delay between retries, must be nonnegative.
Default value: 30 seconds.
The number of retry attempts.
Default value: 5.
Configure connection to use MySql default provider.
Configure connection to use MySql default provider and connection string.
Configure connection to use MySqlConnector MySql provider.
Configure connection to use MySqlConnector MySql provider and connection string.
Configure connection to use MySql.Data MySql provider.
Configure connection to use MySql.Data MySql provider and connection string.
Defines entity descriptor creation callback to use with DataOptions.
If enabled, linq2db will try to reduce number of generated SQL JOINs for LINQ query.
Attempted optimizations:
- removes duplicate joins by unique target table key;
- removes self-joins by unique key;
- removes left joins if joined table is not used in query.
Default value: true.
Configure connection to use Oracle default provider, specific dialect and connection string.
Configure connection to use specific Oracle provider, dialect and provider-specific options.
Configure connection to use specific Oracle provider, dialect and connection string.
Configure connection to use specific Oracle provider and connection string.
Enables Take/Skip parameterization.
Default value: true.
Configure connection to use PostgreSQL Npgsql provider, default dialect and connection string.
Configure connection to use PostgreSQL Npgsql provider, specific dialect and provider-specific options.
Configure connection to use PostgreSQL Npgsql provider, specific dialect, provider-specific options and connection string.
Used to generate CROSS APPLY or OUTER APPLY if possible.
Default value: true.
Depending on this option linq2db generates different SQL for sequence.Contains(value).true - EXISTS (SELECT * FROM sequence WHERE sequence.key = value).false - value IN (SELECT sequence.key FROM sequence).
Default value: false.
Controls how group data for LINQ queries ended with GroupBy will be loaded:
- if
true - group data will be loaded together with main query, resulting in 1 + N queries, where N - number of groups;
- if
false - group data will be loaded when you call enumerator for specific group
IGrouping<T, U>.
Default value:
false.
Defines provider name to use with DataOptions.
The maximum random factor, must not be lesser than 1.
Default value: 1.1.
Uses retry policy.
Configure connection to use SAP HANA default provider.
Configure connection to use SAP HANA default provider and connection string.
Configure connection to use native SAP HANA provider.
Configure connection to use native SAP HANA provider and connection string.
Configure connection to use SAP HANA ODBC provider.
Configure connection to use SAP HANA ODBC provider and connection string.
Configure connection to use SQL CE provider.
Configure connection to use SQL CE provider and connection string.
Configure connection to use SQLite default provider.
Configure connection to use SQLite default provider and connection string.
Configure connection to use Microsoft.Data.Sqlite SQLite provider.
Configure connection to use Microsoft.Data.Sqlite SQLite provider and connection string.
Configure connection to use System.Data.Sqlite SQLite provider.
Configure connection to use System.Data.Sqlite SQLite provider and connection string.
Configure connection to use specific SQL Server provider, dialect and provider-specific options.
Configure connection to use specific SQL Server provider, dialect, connection string and provider-specific options.
Configure the database to use specified trace level.
Enables logging of generated mapping expression to data connection tracing infrastructure.
See
TraceSwitch for more details.
Default value:
false.
Configure the database to use the specified a string trace callback.
Configure the database to use the specified callback for logging or tracing.
Configure the database to use the specified trace level and callback for logging or tracing.
Defines data provider and transaction to use with DataOptions.
Sets custom actions, executed after connection opened.
Sets custom actions, executed before connection opened.
Number of seconds for the operation to complete before it times out.
Bulk copy mode.
Specifies timeout when query will be evicted from cache since last execution of query.
Default value is 1 hour.
Checks constraints while data is being inserted.
The coefficient for the exponential function used to compute the delay between retries, must be nonnegative.
Default value: 1 second.
If set to true nullable fields would be checked for IS NULL in Equal/NotEqual comparisons.
This affects: Equal, NotEqual, Not Contains
Default value: true.
Sets ConfigurationString option.
Sets ConnectionFactory option.
Sets ConnectionString option.
Gets or sets explicit name of target database instead of one, configured for copied entity in mapping schema.
See
DatabaseName<T> method for support information per provider.
Sets DataProvider option.
Sets DataProviderFactory option.
Sets DbConnection option.
Sets DbTransaction option.
Used to disable LINQ expressions caching for queries.
This cache reduces time, required for query parsing but have several side-effects:
- cached LINQ expressions could contain references to external objects as parameters, which could lead to memory leaks if those objects are not used anymore by other code
- cache access synchronization could lead to bigger latencies than it saves.
Default value:
false.
It is not recommended to enable this option as it could lead to severe slowdown. Better approach will be
to call
ClearCache method to cleanup cache after queries, that produce severe memory leaks you need to fix.
More details.
Sets DisposeConnection option.
Controls behavior, when LINQ query chain contains multiple
OrderBy<T, U> or
OrderByDescending<T, U> calls:
- if
true - non-first OrderBy* call will be treated as ThenBy* call;
- if
false - OrderBy* call will discard sort specifications, added by previous OrderBy* and ThenBy* calls.
Default value:
false.
If
true, user could add new mappings to context mapping schems (
MappingSchema).
Otherwise
LinqToDBException will be generated on locked mapping schema edit attempt.
It is not recommended to enable this option as it has performance implications.
Proper approach is to create single
MappingSchema instance once, configure mappings for it and use this
MappingSchema instance for all context instances.
The base for the exponential function used to compute the delay between retries, must be positive.
Default value: 2.
Retry policy factory method, used to create retry policy for new
DataConnection instance.
If factory method is not set, retry policy is not used.
Not set by default.
When specified, causes the server to fire the insert triggers for the rows being inserted into the database.
Enables generation of test class for each LINQ query, executed while this option is enabled.
This option could be useful for issue reporting, when you need to provide reproducible case.
Test file will be placed to
linq2db subfolder of temp folder and exact file path will be logged
to data connection tracing infrastructure.
See
TraceSwitch for more details.
Default value:
false.
Controls behavior of LINQ query, which ends with GroupBy call.
- if
true -
LinqToDBException will be thrown for such queries;
- if
false - behavior is controlled by
UsePreloadGroups option.
Default value:
true.
Controls behavior of linq2db when there is no updateable fields in Update query:
- if
true - query not executed and Update operation returns 0 as number of affected records;
- if
false -
LinqToDBException will be thrown.
Default value:
false.
Allows SQL generation to automatically transform
SELECT DISTINCT value FROM Table ORDER BY date
Into GROUP BY equivalent if syntax is not supported
Default value: true.
If this option set to true, bulk copy will use values of columns, marked with IsIdentity flag.
SkipOnInsert flag in this case will be ignored.
Otherwise those columns will be skipped and values will be generated by server.
Not compatible with
RowByRow mode.
Preserves null values in the destination table regardless of the settings for default values.
Sets MappingSchema option.
Number of rows in each batch. At the end of each batch, the rows in the batch are sent to the server.
Returns an integer value or zero if no value has been set.
Implemented only by ClickHouse.Client provider. Defines number of connections, used for parallel insert in
ProviderSpecific mode.
The maximum time delay between retries, must be nonnegative.
Default value: 30 seconds.
If set, will override the Maximum parameters per batch statement from
MaxParameters.
The number of retry attempts.
Default value: 5.
Gets or sets counter after how many copied records
RowsCopiedCallback should be called.
E.g. if you set it to 10, callback will be called after each 10 copied records.
To disable callback, set this option to 0 (default value).
Sets OnEntityDescriptorCreated option.
Configure the database to use the specified callback for logging or tracing.
If enabled, linq2db will try to reduce number of generated SQL JOINs for LINQ query.
Attempted optimizations:
- removes duplicate joins by unique target table key;
- removes self-joins by unique key;
- removes left joins if joined table is not used in query.
Default value: true.
Enables Take/Skip parameterization.
Default value: true.
Used to generate CROSS APPLY or OUTER APPLY if possible.
Default value: true.
Depending on this option linq2db generates different SQL for sequence.Contains(value).true - EXISTS (SELECT * FROM sequence WHERE sequence.key = value).false - value IN (SELECT sequence.key FROM sequence).
Default value: false.
Controls how group data for LINQ queries ended with GroupBy will be loaded:
- if
true - group data will be loaded together with main query, resulting in 1 + N queries, where N - number of groups;
- if
false - group data will be loaded when you call enumerator for specific group
IGrouping<T, U>.
Default value:
false.
Sets ProviderName option.
The maximum random factor, must not be lesser than 1.
Default value: 1.1.
Uses retry policy
Gets or sets callback method that will be called by BulkCopy operation after each
NotifyAfter rows copied.
This callback will not be used if
NotifyAfter set to 0.
Gets or sets explicit name of target schema/owner instead of one, configured for copied entity in mapping schema.
See
SchemaName<T> method for support information per provider.
Gets or sets explicit name of target server instead of one, configured for copied entity in mapping schema.
See
ServerName<T> method for support information per provider.
Also note that it is not supported by provider-specific insert method.
Obtains a bulk update lock for the duration of the bulk copy operation.
Gets or sets explicit name of target table instead of one, configured for copied entity in mapping schema.
Gets or sets
TableOptions flags overrides instead of configured for copied entity in mapping schema.
See
IsTemporary<T> method for support information per provider.
Configure the database to use specified trace level.
Enables logging of generated mapping expression to data connection tracing infrastructure.
See
TraceSwitch for more details.
Default value:
false.
When specified, each batch of the bulk-copy operation will occur within a transaction.
Gets or sets whether to Always use Parameters for MultipleRowsCopy. Default is false.
If True, provider's override for
MaxParameters will be used to determine the maximum number of rows per insert,
Unless overridden by
MaxParametersForBatch.
Implemented only by ClickHouse.Client provider. When set, provider-specific bulk copy will use session-less connection even if called over connection with session.
Note that session-less connections cannot be used with session-bound functionality like temporary tables.
Configure the database to use the specified a string trace callback.