Interface ITemporaryTableBuilder

Namespace
RentADeveloper.DbConnectionPlus.DatabaseAdapters
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

connection DbConnection

The database connection to use to build the table.

transaction DbTransaction

The database transaction within to build the table.

name string

The name of the table to build.

values IEnumerable

The values with which to populate the table.

valuesType Type

The type of values in values.

cancellationToken CancellationToken

A 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

name is empty or consists only of white-space characters.

ArgumentNullException
ArgumentOutOfRangeException
  • connection is not of a compatible type.
  • transaction is 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

connection DbConnection

The database connection to use to build the table.

transaction DbTransaction

The database transaction within to build the table.

name string

The name of the table to build.

values IEnumerable

The values with which to populate the table.

valuesType Type

The type of values in values.

cancellationToken CancellationToken

A 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

name is empty or consists only of white-space characters.

ArgumentNullException
ArgumentOutOfRangeException
  • connection is not of a compatible type.
  • transaction is not null and not of a compatible type.