ISqlStorageProvider<TParameter,TParameterFactory,TReader> Interface
Extends ISqlStorageProvider<TReader> with parameterised query execution, wildcard escaping, and collation support.
public interface ISqlStorageProvider<TParameter,TParameterFactory,TReader> : HAKOM.Persistence.Sql.Net.Api.ISqlStorageProvider<TReader>, HAKOM.Persistence.Sql.Net.Api.ISqlStorageProvider, HAKOM.Persistence.Core.Net.Api.Storage.IStorageProvider where TParameter : HAKOM.Persistence.Sql.Net.Api.ISqlParameter where TParameterFactory : HAKOM.Persistence.Sql.Net.Api.ISqlParameterFactory<TParameter> where TReader : System.Data.IDataReaderType parameters
Section titled “Type parameters”TParameter
The SQL parameter type used by this provider.
TParameterFactory
The factory type that creates TParameter instances.
TReader
The provider-specific System.Data.IDataReader implementation.
Derived
↳ SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>
Implements HAKOM.Persistence.Sql.Net.Api.ISqlStorageProvider<TReader>, ISqlStorageProvider, IStorageProvider
Remarks
Section titled “Remarks”This is the primary interface consumed by store implementations that need to run parameterised queries. It exposes a Parameters property for creating parameters, an EscapeCharacter for building LIKE/ESCAPE clauses, and an OrderCollation for explicit ORDER BY collation.
Properties
Section titled “Properties”ISqlStorageProvider<TParameter,TParameterFactory,TReader>.EscapeCharacter Property
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.EscapeCharacter Property”Gets the character used to escape SQL wildcard characters in LIKE patterns.
char EscapeCharacter { get; }Property Value
Section titled “Property Value”ISqlStorageProvider<TParameter,TParameterFactory,TReader>.OrderCollation Property
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.OrderCollation Property”The collation that’s configured to be used when explicitly ordering results by individual columns.
string? OrderCollation { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”May be null indicating no explicit collation should be used.
Note that collation will not be applied by the storage provider. The calling code must modify its queries to add the COLLATE statement to the order by clauses. This property is just to provide access to the configured value (or a sensible default if none is configured).
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.Parameters Property
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.Parameters Property”Gets the parameter factory for creating TParameter instances.
TParameterFactory Parameters { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”ISqlStorageProvider<TParameter,TParameterFactory,TReader>.Execute(string, CancellationToken, TParameter[]) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.Execute(string, CancellationToken, TParameter[]) Method”Executes a non-query SQL statement with the supplied parameters and returns the number of rows affected.
System.Threading.Tasks.Task<int> Execute(string sql, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken), params TParameter[] parameters);Parameters
Section titled “Parameters”sql System.String
The SQL statement to execute.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
parameters TParameter[]
The parameters to bind to the SQL statement.
Returns
Section titled “Returns”System.Threading.Tasks.Task<System.Int32>
The number of rows affected by the statement.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.ReplaceOrEscapeWildcard(string) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.ReplaceOrEscapeWildcard(string) Method”Escapes SQL wildcard characters (%, _) in the given
query string and translates user-facing wildcards
(*, ?) to their SQL equivalents.
string ReplaceOrEscapeWildcard(string query);Parameters
Section titled “Parameters”query System.String
The search pattern to transform.
Returns
Section titled “Returns”System.String
A SQL-safe LIKE pattern with wildcards properly escaped or translated.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.Select<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, bool, CancellationToken) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.Select<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, bool, CancellationToken) Method”Executes a parameterised SQL query and streams all results parsed by an asynchronous parser delegate, with control over error handling.
System.Collections.Generic.IAsyncEnumerable<TResult> Select<TResult>(string sql, System.Collections.Generic.IEnumerable<TParameter> parameters, System.Func<TReader,System.Threading.Tasks.Task<TResult>> parser, bool abortOnParseError, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
The type of the parsed result.
Parameters
Section titled “Parameters”sql System.String
The SQL query to execute.
parameters System.Collections.Generic.IEnumerable<TParameter>
The parameters to bind to the query.
parser System.Func<TReader,System.Threading.Tasks.Task<TResult>>
An asynchronous delegate that converts a TReader row into TResult.
abortOnParseError System.Boolean
If true, stops enumeration when a parse error occurs; otherwise, skips failed rows.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<TResult>
An asynchronous sequence of parsed results.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.Select<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, CancellationToken) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.Select<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, CancellationToken) Method”Executes a parameterised SQL query and streams all results parsed by an asynchronous parser delegate.
System.Collections.Generic.IAsyncEnumerable<TResult> Select<TResult>(string sql, System.Collections.Generic.IEnumerable<TParameter> parameters, System.Func<TReader,System.Threading.Tasks.Task<TResult>> parser, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
The type of the parsed result.
Parameters
Section titled “Parameters”sql System.String
The SQL query to execute.
parameters System.Collections.Generic.IEnumerable<TParameter>
The parameters to bind to the query.
parser System.Func<TReader,System.Threading.Tasks.Task<TResult>>
An asynchronous delegate that converts a TReader row into TResult.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<TResult>
An asynchronous sequence of parsed results.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.Select<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, bool, CancellationToken) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.Select<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, bool, CancellationToken) Method”Executes a parameterised SQL query and streams all results parsed by a synchronous parser delegate, with control over error handling.
System.Collections.Generic.IAsyncEnumerable<TResult> Select<TResult>(string sql, System.Collections.Generic.IEnumerable<TParameter> parameters, System.Func<TReader,TResult> parser, bool abortOnParseError, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
The type of the parsed result.
Parameters
Section titled “Parameters”sql System.String
The SQL query to execute.
parameters System.Collections.Generic.IEnumerable<TParameter>
The parameters to bind to the query.
parser System.Func<TReader,TResult>
A synchronous delegate that converts a TReader row into TResult.
abortOnParseError System.Boolean
If true, stops enumeration when a parse error occurs; otherwise, skips failed rows.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<TResult>
An asynchronous sequence of parsed results.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.Select<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, CancellationToken) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.Select<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, CancellationToken) Method”Executes a parameterised SQL query and streams all results parsed by a synchronous parser delegate.
System.Collections.Generic.IAsyncEnumerable<TResult> Select<TResult>(string sql, System.Collections.Generic.IEnumerable<TParameter> parameters, System.Func<TReader,TResult> parser, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
The type of the parsed result.
Parameters
Section titled “Parameters”sql System.String
The SQL query to execute.
parameters System.Collections.Generic.IEnumerable<TParameter>
The parameters to bind to the query.
parser System.Func<TReader,TResult>
A synchronous delegate that converts a TReader row into TResult.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<TResult>
An asynchronous sequence of parsed results.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.SelectFirst<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, CancellationToken) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.SelectFirst<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, CancellationToken) Method”Executes a parameterised SQL query and returns the first result parsed by an asynchronous parser delegate.
System.Threading.Tasks.Task<TResult> SelectFirst<TResult>(string sql, System.Collections.Generic.IEnumerable<TParameter> parameters, System.Func<TReader,System.Threading.Tasks.Task<TResult>> parser, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
The type of the parsed result.
Parameters
Section titled “Parameters”sql System.String
The SQL query to execute.
parameters System.Collections.Generic.IEnumerable<TParameter>
The parameters to bind to the query.
parser System.Func<TReader,System.Threading.Tasks.Task<TResult>>
An asynchronous delegate that converts a TReader row into TResult.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Threading.Tasks.Task<TResult>
The first parsed result.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.SelectFirst<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, CancellationToken) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.SelectFirst<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, CancellationToken) Method”Executes a parameterised SQL query and returns the first result parsed by a synchronous parser delegate.
System.Threading.Tasks.Task<TResult> SelectFirst<TResult>(string sql, System.Collections.Generic.IEnumerable<TParameter> parameters, System.Func<TReader,TResult> parser, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
The type of the parsed result.
Parameters
Section titled “Parameters”sql System.String
The SQL query to execute.
parameters System.Collections.Generic.IEnumerable<TParameter>
The parameters to bind to the query.
parser System.Func<TReader,TResult>
A synchronous delegate that converts a TReader row into TResult.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Threading.Tasks.Task<TResult>
The first parsed result.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TryExecute(string, CancellationToken, TParameter[]) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TryExecute(string, CancellationToken, TParameter[]) Method”Attempts to execute a non-query SQL statement with the supplied parameters and returns a Result<TValue> containing the number of rows affected.
System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<int>> TryExecute(string sql, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken), params TParameter[] parameters);Parameters
Section titled “Parameters”sql System.String
The SQL statement to execute.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
parameters TParameter[]
The parameters to bind to the SQL statement.
Returns
Section titled “Returns”System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<System.Int32>>
A Result<TValue> containing the number of rows affected, or an error.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, bool, CancellationToken) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, bool, CancellationToken) Method”Attempts to execute a parameterised SQL query and streams all results parsed by an asynchronous parser delegate, with control over error handling.
System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>> TrySelect<TResult>(string sql, System.Collections.Generic.IEnumerable<TParameter> parameters, System.Func<TReader,System.Threading.Tasks.Task<TResult>> parser, bool abortOnParseError, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
The type of the parsed result.
Parameters
Section titled “Parameters”sql System.String
The SQL query to execute.
parameters System.Collections.Generic.IEnumerable<TParameter>
The parameters to bind to the query.
parser System.Func<TReader,System.Threading.Tasks.Task<TResult>>
An asynchronous delegate that converts a TReader row into TResult.
abortOnParseError System.Boolean
If true, stops enumeration when a parse error occurs; otherwise, skips failed rows.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
An asynchronous sequence of Result<TValue> containing parsed results or errors.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, CancellationToken) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, CancellationToken) Method”Attempts to execute a parameterised SQL query and streams all results parsed by an asynchronous parser delegate.
System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>> TrySelect<TResult>(string sql, System.Collections.Generic.IEnumerable<TParameter> parameters, System.Func<TReader,System.Threading.Tasks.Task<TResult>> parser, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
The type of the parsed result.
Parameters
Section titled “Parameters”sql System.String
The SQL query to execute.
parameters System.Collections.Generic.IEnumerable<TParameter>
The parameters to bind to the query.
parser System.Func<TReader,System.Threading.Tasks.Task<TResult>>
An asynchronous delegate that converts a TReader row into TResult.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
An asynchronous sequence of Result<TValue> containing parsed results or errors.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, bool, CancellationToken) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, bool, CancellationToken) Method”Attempts to execute a parameterised SQL query and streams all results parsed by a synchronous parser delegate, with control over error handling.
System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>> TrySelect<TResult>(string sql, System.Collections.Generic.IEnumerable<TParameter> parameters, System.Func<TReader,TResult> parser, bool abortOnParseError, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
The type of the parsed result.
Parameters
Section titled “Parameters”sql System.String
The SQL query to execute.
parameters System.Collections.Generic.IEnumerable<TParameter>
The parameters to bind to the query.
parser System.Func<TReader,TResult>
A synchronous delegate that converts a TReader row into TResult.
abortOnParseError System.Boolean
If true, stops enumeration when a parse error occurs; otherwise, skips failed rows.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
An asynchronous sequence of Result<TValue> containing parsed results or errors.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, CancellationToken) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, CancellationToken) Method”Attempts to execute a parameterised SQL query and streams all results parsed by a synchronous parser delegate.
System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>> TrySelect<TResult>(string sql, System.Collections.Generic.IEnumerable<TParameter> parameters, System.Func<TReader,TResult> parser, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
The type of the parsed result.
Parameters
Section titled “Parameters”sql System.String
The SQL query to execute.
parameters System.Collections.Generic.IEnumerable<TParameter>
The parameters to bind to the query.
parser System.Func<TReader,TResult>
A synchronous delegate that converts a TReader row into TResult.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
An asynchronous sequence of Result<TValue> containing parsed results or errors.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TrySelectFirst<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, CancellationToken) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TrySelectFirst<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, CancellationToken) Method”Attempts to execute a parameterised SQL query and return the first result parsed by an asynchronous parser delegate.
System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>> TrySelectFirst<TResult>(string sql, System.Collections.Generic.IEnumerable<TParameter> parameters, System.Func<TReader,System.Threading.Tasks.Task<TResult>> parser, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
The type of the parsed result.
Parameters
Section titled “Parameters”sql System.String
The SQL query to execute.
parameters System.Collections.Generic.IEnumerable<TParameter>
The parameters to bind to the query.
parser System.Func<TReader,System.Threading.Tasks.Task<TResult>>
An asynchronous delegate that converts a TReader row into TResult.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
A Result<TValue> containing the first parsed result, or an error.
ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TrySelectFirst<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, CancellationToken) Method
Section titled “ISqlStorageProvider<TParameter,TParameterFactory,TReader>.TrySelectFirst<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, CancellationToken) Method”Attempts to execute a parameterised SQL query and return the first result parsed by a synchronous parser delegate.
System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>> TrySelectFirst<TResult>(string sql, System.Collections.Generic.IEnumerable<TParameter> parameters, System.Func<TReader,TResult> parser, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
The type of the parsed result.
Parameters
Section titled “Parameters”sql System.String
The SQL query to execute.
parameters System.Collections.Generic.IEnumerable<TParameter>
The parameters to bind to the query.
parser System.Func<TReader,TResult>
A synchronous delegate that converts a TReader row into TResult.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
A Result<TValue> containing the first parsed result, or an error.