DapperQueryOptions Class
Definition
- Namespace
- Savvyio.Extensions.Dapper
- Assemblies
- Savvyio.Extensions.Dapper.dll
Specifies options that is related to DapperDataStore<T, TOptions>.
public class DapperQueryOptions : AsyncOptions, IAsyncOptions, IParameterObject
- Inheritance
-
objectDapperQueryOptions
- Implements
- Inherited Members
Examples
This example shows how DapperQueryOptions becomes a CommandDefinition that carries the SQL text, parameters, and timeout for one query.
using System;
using System.Data;
using Dapper;
using Savvyio.Extensions.Dapper;
namespace ExampleApp;
public sealed class QueryOptionsExample
{
public CommandDefinition BuildCommand()
{
var options = new DapperQueryOptions
{
CommandText = "SELECT * FROM Orders WHERE Status = @Status",
Parameters = new { Status = "Pending" },
CommandTimeout = TimeSpan.FromSeconds(15),
CommandType = CommandType.Text
};
return options;
}
}
Constructors
| Name | Description |
|---|---|
| DapperQueryOptions() | Initializes a new instance of the DapperQueryOptions class. |
Properties
| Name | Description |
|---|---|
| CommandFlags | Gets or sets the state flags against the command. |
| CommandText | Gets or sets the command (sql or a stored-procedure name) to execute. |
| CommandTimeout | Gets or sets the timeout for the command. |
| CommandType | Gets or sets the type of command that the command-text represents. |
| Parameters | Gets or sets the parameters associated with the command. |
| Transaction | Gets or sets the active transaction for the command. |
Operators
| Name | Description |
|---|---|
| implicit operator CommandDefinition(DapperQueryOptions) | Performs an implicit conversion from DapperQueryOptions to Dapper.CommandDefinition. |