Table of Contents

Struct BulkCopyFlags

Namespace
NextORM.Core
Assembly
nextorm.core.dll

The provider-specific bulk-copy flags requested for a write, passed to the native bulk hooks BulkInsertRows(string, IReadOnlyList<string>, IReadOnlyList<IPropertyMetadata>, IEnumerable<object?[]>, int?, int?, Action<int>?, int, BulkCopyFlags) and BulkInsertRowsAsync(string, IReadOnlyList<string>, IReadOnlyList<IPropertyMetadata>, IAsyncEnumerable<object?[]>, int?, int?, Action<int>?, int, BulkCopyFlags, CancellationToken). A set flag is a request; an unset flag means "not requested", so an explicitly supplied false on BulkInsertOptions never appears here (absence is the off state). Only the SQL Server native SqlBulkCopy path can express TableLock and FireTriggers; CheckConstraints=true and KeepNulls=true are honoured by every path, the first because a path that always checks constraints needs no request and the second because every path writes the caller's values.

public readonly record struct BulkCopyFlags : IEquatable<BulkCopyFlags>
Implements
Inherited Members
Extension Methods

Constructors

BulkCopyFlags(bool, bool, bool, bool)

The provider-specific bulk-copy flags requested for a write, passed to the native bulk hooks BulkInsertRows(string, IReadOnlyList<string>, IReadOnlyList<IPropertyMetadata>, IEnumerable<object?[]>, int?, int?, Action<int>?, int, BulkCopyFlags) and BulkInsertRowsAsync(string, IReadOnlyList<string>, IReadOnlyList<IPropertyMetadata>, IAsyncEnumerable<object?[]>, int?, int?, Action<int>?, int, BulkCopyFlags, CancellationToken). A set flag is a request; an unset flag means "not requested", so an explicitly supplied false on BulkInsertOptions never appears here (absence is the off state). Only the SQL Server native SqlBulkCopy path can express TableLock and FireTriggers; CheckConstraints=true and KeepNulls=true are honoured by every path, the first because a path that always checks constraints needs no request and the second because every path writes the caller's values.

public BulkCopyFlags(bool CheckConstraints, bool TableLock, bool KeepNulls, bool FireTriggers)

Parameters

CheckConstraints bool

Whether CHECK and FOREIGN KEY constraints are checked.

TableLock bool

Whether a table-level bulk-update lock is taken.

KeepNulls bool

Whether explicit nulls are written instead of the destination DEFAULT.

FireTriggers bool

Whether INSERT triggers fire for the written rows.

Fields

None

The empty flag set, equivalent to a write with no bulk-copy flags.

public static readonly BulkCopyFlags None

Field Value

BulkCopyFlags

Properties

CheckConstraints

Whether CHECK and FOREIGN KEY constraints are checked.

public bool CheckConstraints { get; init; }

Property Value

bool

FireTriggers

Whether INSERT triggers fire for the written rows.

public bool FireTriggers { get; init; }

Property Value

bool

IsAny

Whether at least one flag is set.

public bool IsAny { get; }

Property Value

bool

KeepNulls

Whether explicit nulls are written instead of the destination DEFAULT.

public bool KeepNulls { get; init; }

Property Value

bool

TableLock

Whether a table-level bulk-update lock is taken.

public bool TableLock { get; init; }

Property Value

bool

Methods

ThrowIfRequested(string)

Throws NotSupportedException naming every requested flag the path cannot express, so a path that cannot honour the request fails loudly instead of ignoring it. Only TableLock and FireTriggers are rejected: CheckConstraints=true and KeepNulls=true match the default behaviour of every path and are therefore already honoured.

public void ThrowIfRequested(string path)

Parameters

path string

The bulk path that cannot express the flags (for the error message).

Exceptions

NotSupportedException

A flag the path cannot express is set.