Struct SqlDatabaseBuilderCommandAction
Represents a definition of an SQL statement to be ran by an ISqlDatabaseFactory.
public readonly struct SqlDatabaseBuilderCommandAction
- Inherited Members
Properties
OnCommandSetup
Delegate that prepares the IDbCommand. Can be used to e.g. prepare a collection of parameters.
public Action<IDbCommand>? OnCommandSetup { get; }
Property Value
OnExecute
Delegate that executes the IDbCommand.
public Func<IDbCommand, object?> OnExecute { get; }
Property Value
Sql
Underlying SQL statement.
public string? Sql { get; }
Property Value
Timeout
Optional custom CommandTimeout. Overrides CommandTimeout if not null.
public TimeSpan? Timeout { get; }
Property Value
Methods
CreateCustom(Action<IDbCommand>, Action<IDbCommand>?, TimeSpan?)
Creates a new SqlDatabaseBuilderCommandAction instance with custom execution.
[Pure]
public static SqlDatabaseBuilderCommandAction CreateCustom(Action<IDbCommand> onExecute, Action<IDbCommand>? onCommandSetup = null, TimeSpan? timeout = null)
Parameters
onExecute
Action<IDbCommand>Custom delegate that executes the IDbCommand.
onCommandSetup
Action<IDbCommand>Optional delegate that prepares the IDbCommand. Can be used to e.g. prepare a collection of parameters. Equal to null by default.
timeout
TimeSpan?Optional custom CommandTimeout. Equal to null by default.
Returns
CreateSql(string, SqlParameterBinderExecutor, TimeSpan?)
Creates a new SqlDatabaseBuilderCommandAction instance with bound parameters.
[Pure]
public static SqlDatabaseBuilderCommandAction CreateSql(string sql, SqlParameterBinderExecutor boundParameters, TimeSpan? timeout = null)
Parameters
sql
stringUnderlying SQL statement.
boundParameters
SqlParameterBinderExecutorSqlParameterBinderExecutor instance that represents parameters to bind.
timeout
TimeSpan?Optional custom CommandTimeout. Equal to null by default.
Returns
CreateSql(string, TimeSpan?)
Creates a new SqlDatabaseBuilderCommandAction instance.
[Pure]
public static SqlDatabaseBuilderCommandAction CreateSql(string sql, TimeSpan? timeout = null)
Parameters
sql
stringUnderlying SQL statement.
timeout
TimeSpan?Optional custom CommandTimeout. Equal to null by default.
Returns
CreateSql<T>(string, SqlParameterBinderExecutor<T>, TimeSpan?)
Creates a new SqlDatabaseBuilderCommandAction instance with bound parameters.
[Pure]
public static SqlDatabaseBuilderCommandAction CreateSql<T>(string sql, SqlParameterBinderExecutor<T> boundParameters, TimeSpan? timeout = null) where T : notnull
Parameters
sql
stringUnderlying SQL statement.
boundParameters
SqlParameterBinderExecutor<T>SqlParameterBinderExecutor instance that represents parameters to bind.
timeout
TimeSpan?Optional custom CommandTimeout. Equal to null by default.
Returns
Type Parameters
T
Parameter source type.
ToString()
Returns a string representation of this SqlDatabaseBuilderCommandAction instance.
[Pure]
public override string ToString()
Returns
- string
String representation.