Class BulkCopyOptions
Defines behavior of BulkCopy<T>(DataConnection, BulkCopyOptions, IEnumerable<T>) method.
public sealed record BulkCopyOptions : IOptionSet, IConfigurationID, IEquatable<BulkCopyOptions>
- Inheritance
-
BulkCopyOptions
- Implements
- Extension Methods
Constructors
BulkCopyOptions()
public BulkCopyOptions()
BulkCopyOptions(int?, int?, BulkCopyType, bool?, bool?, bool?, bool?, bool?, bool?, string?, string?, string?, string?, TableOptions, int, Action<BulkCopyRowsCopied>?, bool, int?, int?, bool)
Defines behavior of BulkCopy<T>(DataConnection, BulkCopyOptions, IEnumerable<T>) method.
public BulkCopyOptions(int? MaxBatchSize = null, int? BulkCopyTimeout = null, BulkCopyType BulkCopyType = BulkCopyType.Default, bool? CheckConstraints = null, bool? KeepIdentity = null, bool? TableLock = null, bool? KeepNulls = null, bool? FireTriggers = null, bool? UseInternalTransaction = null, string? ServerName = null, string? DatabaseName = null, string? SchemaName = null, string? TableName = null, TableOptions TableOptions = TableOptions.NotSet, int NotifyAfter = 0, Action<BulkCopyRowsCopied>? RowsCopiedCallback = null, bool UseParameters = false, int? MaxParametersForBatch = null, int? MaxDegreeOfParallelism = null, bool WithoutSession = false)
Parameters
MaxBatchSize
int?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.
BulkCopyTimeout
int?Number of seconds for the operation to complete before it times out.
BulkCopyType
BulkCopyTypeDefault bulk copy mode, used by BulkCopy<T>(DataConnection, IEnumerable<T>) methods, if mode is not specified explicitly.
CheckConstraints
bool?Enables database constrains enforcement during bulk copy operation. Supported with ProviderSpecific bulk copy mode for following databases:
- Oracle
- SQL Server
- SAP/Sybase ASE
KeepIdentity
bool?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.
TableLock
bool?Applies table lock during bulk copy operation. Supported with ProviderSpecific bulk copy mode for following databases:
- DB2
- Informix (using DB2 provider)
- SQL Server
- SAP/Sybase ASE
KeepNulls
bool?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 Server
- SAP/Sybase ASE
FireTriggers
bool?Enables insert triggers during bulk copy operation. Supported with ProviderSpecific bulk copy mode for following databases:
- Oracle
- SQL Server
- SAP/Sybase ASE
UseInternalTransaction
bool?Enables automatic transaction creation during bulk copy operation. Supported with ProviderSpecific bulk copy mode for following databases:
- Oracle
- SQL Server
- SAP/Sybase ASE
ServerName
stringGets or sets explicit name of target server instead of one, configured for copied entity in mapping schema. See ServerName<T>(ITable<T>, string?) method for support information per provider. Also note that it is not supported by provider-specific insert method.
DatabaseName
stringGets or sets explicit name of target database instead of one, configured for copied entity in mapping schema. See DatabaseName<T>(ITable<T>, string?) method for support information per provider.
SchemaName
stringGets or sets explicit name of target schema/owner instead of one, configured for copied entity in mapping schema. See SchemaName<T>(ITable<T>, string?) method for support information per provider.
TableName
stringGets or sets explicit name of target table instead of one, configured for copied entity in mapping schema.
TableOptions
TableOptionsGets or sets TableOptions flags overrides instead of configured for copied entity in mapping schema. See IsTemporary<T>(ITable<T>, bool) method for support information per provider.
NotifyAfter
intGets 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).
RowsCopiedCallback
Action<BulkCopyRowsCopied>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.
UseParameters
boolGets 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.
MaxParametersForBatch
int?If set, will override the Maximum parameters per batch statement from MaxParameters.
MaxDegreeOfParallelism
int?Implemented only by ClickHouse.Client provider. Defines number of connections, used for parallel insert in ProviderSpecific mode.
WithoutSession
boolImplemented 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.
Fields
Empty
public static readonly BulkCopyOptions Empty
Field Value
Properties
BulkCopyTimeout
Number of seconds for the operation to complete before it times out.
public int? BulkCopyTimeout { get; init; }
Property Value
- int?
BulkCopyType
Default bulk copy mode, used by BulkCopy<T>(DataConnection, IEnumerable<T>) methods, if mode is not specified explicitly.
public BulkCopyType BulkCopyType { get; init; }
Property Value
CheckConstraints
Enables database constrains enforcement during bulk copy operation. Supported with ProviderSpecific bulk copy mode for following databases:
- Oracle
- SQL Server
- SAP/Sybase ASE
public bool? CheckConstraints { get; init; }
Property Value
- bool?
DatabaseName
Gets or sets explicit name of target database instead of one, configured for copied entity in mapping schema. See DatabaseName<T>(ITable<T>, string?) method for support information per provider.
public string? DatabaseName { get; init; }
Property Value
FireTriggers
Enables insert triggers during bulk copy operation. Supported with ProviderSpecific bulk copy mode for following databases:
- Oracle
- SQL Server
- SAP/Sybase ASE
public bool? FireTriggers { get; init; }
Property Value
- bool?
KeepIdentity
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.
public bool? KeepIdentity { get; init; }
Property Value
- bool?
KeepNulls
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 Server
- SAP/Sybase ASE
public bool? KeepNulls { get; init; }
Property Value
- bool?
MaxBatchSize
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.
public int? MaxBatchSize { get; init; }
Property Value
- int?
MaxDegreeOfParallelism
Implemented only by ClickHouse.Client provider. Defines number of connections, used for parallel insert in ProviderSpecific mode.
public int? MaxDegreeOfParallelism { get; init; }
Property Value
- int?
MaxParametersForBatch
If set, will override the Maximum parameters per batch statement from MaxParameters.
public int? MaxParametersForBatch { get; init; }
Property Value
- int?
NotifyAfter
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).
public int NotifyAfter { get; init; }
Property Value
RowsCopiedCallback
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.
public Action<BulkCopyRowsCopied>? RowsCopiedCallback { get; init; }
Property Value
SchemaName
Gets or sets explicit name of target schema/owner instead of one, configured for copied entity in mapping schema. See SchemaName<T>(ITable<T>, string?) method for support information per provider.
public string? SchemaName { get; init; }
Property Value
ServerName
Gets or sets explicit name of target server instead of one, configured for copied entity in mapping schema. See ServerName<T>(ITable<T>, string?) method for support information per provider. Also note that it is not supported by provider-specific insert method.
public string? ServerName { get; init; }
Property Value
TableLock
Applies table lock during bulk copy operation. Supported with ProviderSpecific bulk copy mode for following databases:
- DB2
- Informix (using DB2 provider)
- SQL Server
- SAP/Sybase ASE
public bool? TableLock { get; init; }
Property Value
- bool?
TableName
Gets or sets explicit name of target table instead of one, configured for copied entity in mapping schema.
public string? TableName { get; init; }
Property Value
TableOptions
Gets or sets TableOptions flags overrides instead of configured for copied entity in mapping schema. See IsTemporary<T>(ITable<T>, bool) method for support information per provider.
public TableOptions TableOptions { get; init; }
Property Value
UseInternalTransaction
Enables automatic transaction creation during bulk copy operation. Supported with ProviderSpecific bulk copy mode for following databases:
- Oracle
- SQL Server
- SAP/Sybase ASE
public bool? UseInternalTransaction { get; init; }
Property Value
- bool?
UseParameters
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.
public bool UseParameters { get; init; }
Property Value
WithoutSession
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.
public bool WithoutSession { get; init; }
Property Value
Methods
Equals(BulkCopyOptions?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(BulkCopyOptions? other)
Parameters
other
BulkCopyOptionsAn 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()