Interface ITemporaryTableBuilder
- Assembly
- RentADeveloper.DbConnectionPlus.dll
Represents a builder that builds temporary database tables.
public interface ITemporaryTableBuilder
Methods
BuildTemporaryTable(DbConnection, DbTransaction?, string, IEnumerable, Type, CancellationToken)
Builds a temporary table and populates it with the specified values.
TemporaryTableDisposer BuildTemporaryTable(DbConnection connection, DbTransaction? transaction, string name, IEnumerable values, Type valuesType, CancellationToken cancellationToken = default)
Parameters
connectionDbConnectionThe database connection to use to build the table.
transactionDbTransactionThe database transaction within to build the table.
namestringThe name of the table to build.
valuesIEnumerableThe values with which to populate the table.
valuesTypeTypeThe type of values in
values.cancellationTokenCancellationTokenA token that can be used to cancel the operation.
Returns
- TemporaryTableDisposer
An instance of TemporaryTableDisposer that can be used to dispose the built table.
Remarks
If the type valuesType is a scalar type
(e.g. string, int, DateTime, Enum and so on),
a single-column table will be built with a column named "Value" with a data type that matches the
type valuesType.
If the type valuesType is a complex type (e.g. a class or a record), a multi-column
table will be built.
The table will contain a column for each instance property (with a public getter) of the type
valuesType.
The name of each column will be the name of the corresponding property.
The data type of each column will match the property type of the corresponding property.
Exceptions
- ArgumentException
nameis empty or consists only of white-space characters.- ArgumentNullException
- ArgumentOutOfRangeException
-
connectionis not of a compatible type. -
transactionis not null and not of a compatible type.
-
BuildTemporaryTableAsync(DbConnection, DbTransaction?, string, IEnumerable, Type, CancellationToken)
Asynchronously builds a temporary table and populates it with the specified values.
Task<TemporaryTableDisposer> BuildTemporaryTableAsync(DbConnection connection, DbTransaction? transaction, string name, IEnumerable values, Type valuesType, CancellationToken cancellationToken = default)
Parameters
connectionDbConnectionThe database connection to use to build the table.
transactionDbTransactionThe database transaction within to build the table.
namestringThe name of the table to build.
valuesIEnumerableThe values with which to populate the table.
valuesTypeTypeThe type of values in
values.cancellationTokenCancellationTokenA token that can be used to cancel the operation.
Returns
- Task<TemporaryTableDisposer>
A task representing the asynchronous operation. Result will contain an instance of TemporaryTableDisposer that can be used to dispose the built table.
Remarks
If the type valuesType is a scalar type
(e.g. string, int, DateTime, Enum and so on),
a single-column table will be built with a column named "Value" with a data type that matches
the type valuesType.
If the type valuesType is a complex type (e.g. a class or a record), a multi-column
table will be built.
The table will contain a column for each instance property (with a public getter) of the type
valuesType.
The name of each column will be the name of the corresponding property.
The data type of each column will match the property type of the corresponding property.
Exceptions
- ArgumentException
nameis empty or consists only of white-space characters.- ArgumentNullException
- ArgumentOutOfRangeException
-
connectionis not of a compatible type. -
transactionis not null and not of a compatible type.
-