Interface ITemporaryTableBuilder
Represents a builder that builds temporary database tables.
Namespace: RentADeveloper.DbConnectionPlus.DatabaseAdapters
Assembly: RentADeveloper.DbConnectionPlus.dll
Syntax
public interface ITemporaryTableBuilder
Methods
View SourceBuildTemporaryTable(DbConnection, DbTransaction?, string, IEnumerable, Type, CancellationToken)
Builds a temporary table and populates it with the specified values.
Declaration
TemporaryTableDisposer BuildTemporaryTable(DbConnection connection, DbTransaction? transaction, string name, IEnumerable values, Type valuesType, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to build the table. |
| DbTransaction | transaction | The database transaction within to build the table. |
| string | name | The name of the table to build. |
| IEnumerable | values | The values with which to populate the table. |
| Type | valuesType | The type of values in |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| 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
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException | |
| ArgumentOutOfRangeException |
|
BuildTemporaryTableAsync(DbConnection, DbTransaction?, string, IEnumerable, Type, CancellationToken)
Asynchronously builds a temporary table and populates it with the specified values.
Declaration
Task<TemporaryTableDisposer> BuildTemporaryTableAsync(DbConnection connection, DbTransaction? transaction, string name, IEnumerable values, Type valuesType, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to build the table. |
| DbTransaction | transaction | The database transaction within to build the table. |
| string | name | The name of the table to build. |
| IEnumerable | values | The values with which to populate the table. |
| Type | valuesType | The type of values in |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| 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
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException | |
| ArgumentOutOfRangeException |
|