Class TruncateBuilder<TEntity>
Fluent terminal for a TRUNCATE TABLE, started with
CreateTruncateBuilder<TEntity>(IDataContext, Action<EntityMetadataBuilder<TEntity>>?). Renders the provider's native form and
executes it on the context; providers without TRUNCATE (SQLite) reject it with
NotSupportedException.
public sealed class TruncateBuilder<TEntity>
Type Parameters
TEntityThe mapped entity type whose table is truncated.
- Inheritance
-
TruncateBuilder<TEntity>
- Inherited Members
- Extension Methods
Methods
Execute()
Executes the truncate and returns the affected-row count where the provider reports one.
public int Execute()
Returns
- int
The affected-row count, or 0 where the provider reports none.
Exceptions
- NotSupportedException
The context is read-only, or the provider has no
TRUNCATE.
ExecuteAsync(CancellationToken)
Asynchronously executes the truncate and returns the affected-row count where the provider reports one.
public Task<int> ExecuteAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels execution.
Returns
Exceptions
- NotSupportedException
The context is read-only, or the provider has no
TRUNCATE.
ToSql()
Renders the parameterised SQL this builder would execute, without executing it.
public string ToSql()
Returns
- string
The rendered SQL text.
Exceptions
- NotSupportedException
The context is not database-backed, or the provider has no
TRUNCATE.