SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory> Class
Abstract base class for SQL-based storage providers that manages the full lifecycle of connecting, executing, reading, and releasing database resources.
public abstract class SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory> : HAKOM.Persistence.Core.Net.Api.Storage.StorageProvider, HAKOM.Persistence.Sql.Net.Api.ISqlStorageProvider<TParameter, TParameterFactory, TReader>, HAKOM.Persistence.Sql.Net.Api.ISqlStorageProvider<TReader>, HAKOM.Persistence.Sql.Net.Api.ISqlStorageProvider, HAKOM.Persistence.Core.Net.Api.Storage.IStorageProvider, HAKOM.DependencyInjection.Core.Net.Api.IRequiresConfiguration where TConnection : class, System.Data.IDbConnection where TCommand : class, System.Data.IDbCommand where TNativeParameter : class, System.Data.IDbDataParameter where TReader : class, System.Data.IDataReader where TParameter : class, HAKOM.Persistence.Sql.Net.Api.ISqlParameter<TNativeParameter> where TParameterFactory : class, HAKOM.Persistence.Sql.Net.Api.ISqlParameterFactory<TParameter>Type parameters
Section titled “Type parameters”TConnection
The provider-specific System.Data.IDbConnection type (e.g. OracleConnection).
TCommand
The provider-specific System.Data.IDbCommand type (e.g. OracleCommand).
TNativeParameter
The native ADO.NET parameter type (e.g. OracleParameter).
TReader
The provider-specific System.Data.IDataReader type (e.g. OracleDataReader).
TParameter
The HAKOM parameter abstraction implementing ISqlParameter<TNative>.
TParameterFactory
The factory type that creates TParameter instances.
Inheritance System.Object 🡒 StorageProvider 🡒 SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>
Implements HAKOM.Persistence.Sql.Net.Api.ISqlStorageProvider<TParameter,TParameterFactory,TReader>, HAKOM.Persistence.Sql.Net.Api.ISqlStorageProvider<TReader>, ISqlStorageProvider, IStorageProvider, IRequiresConfiguration
Constructors
Section titled “Constructors”SqlStorageProvider(DbProviderFactory, TParameterFactory, ILogger<ISqlStorageProvider<TParameter,TParameterFactory,TReader>>) Constructor
Section titled “SqlStorageProvider(DbProviderFactory, TParameterFactory, ILogger<ISqlStorageProvider<TParameter,TParameterFactory,TReader>>) Constructor”Initializes a new instance of the SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory> class.
protected SqlStorageProvider(System.Data.Common.DbProviderFactory providerFactory, TParameterFactory parameterFactory, Microsoft.Extensions.Logging.ILogger<HAKOM.Persistence.Sql.Net.Api.ISqlStorageProvider<TParameter,TParameterFactory,TReader>>? logger=null);Parameters
Section titled “Parameters”providerFactory System.Data.Common.DbProviderFactory
The ADO.NET provider factory used to create connections and commands.
parameterFactory TParameterFactory
The factory used to create SQL parameters.
logger Microsoft.Extensions.Logging.ILogger<HAKOM.Persistence.Sql.Net.Api.ISqlStorageProvider<TParameter,TParameterFactory,TReader>>
An optional logger for diagnostic output.
Properties
Section titled “Properties”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ConnectionString Property
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ConnectionString Property”Gets or sets the connection string used to connect to the database.
protected string ConnectionString { protected get; protected set; }Property Value
Section titled “Property Value”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.DefaultOrderCollation Property
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.DefaultOrderCollation Property”Gets the default collation to use for ORDER BY clauses when none is explicitly configured.
protected abstract string? DefaultOrderCollation { protected get; }Property Value
Section titled “Property Value”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.EscapeCharacter Property
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.EscapeCharacter Property”Gets the character used to escape SQL wildcard characters in LIKE patterns.
public virtual char EscapeCharacter { get; }Implements EscapeCharacter
Property Value
Section titled “Property Value”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.InvalidSqlFloatValueException Property
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.InvalidSqlFloatValueException Property”Gets a shared instance of InvalidSqlFloatValueException for use by derived providers.
protected static HAKOM.Persistence.Sql.Net.Api.Exceptions.InvalidSqlFloatValueException InvalidSqlFloatValueException { protected get; }Property Value
Section titled “Property Value”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.OrderCollation Property
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.OrderCollation Property”The collation that’s configured to be used when explicitly ordering results by individual columns.
public string? OrderCollation { get; }Implements OrderCollation
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).
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.Parameters Property
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.Parameters Property”Gets the parameter factory for creating TParameter instances.
public TParameterFactory Parameters { get; }Implements Parameters
Property Value
Section titled “Property Value”Methods
Section titled “Methods”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ApplyProviderSettings(IReadOnlyDictionary<string,string>) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ApplyProviderSettings(IReadOnlyDictionary<string,string>) Method”Handles common settings for SQL based storage providers. The following are currently handled:
- “OrderCollation” - controls the collation used when ordering results by columns.
- “ConnectionString” - used directly as the connection string.
- Any other settings are added as parameters to the connection string builder.
If derived classes override this, they should call
settings = await base.ApplyProviderSettings([settings](/users-guide/tsm-net-api/technical-specification/hakom/persistence/sql/api/sqlstorageprovideroftconnectiontcommandtnativeparametertreadertparametertparameterfactory/#HAKOM.Persistence.Sql.Net.Api.SqlStorageProvider_TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory_.ApplyProviderSettings(System.Collections.Generic.IReadOnlyDictionary_string,string_).settings 'HAKOM\.Persistence\.Sql\.Net\.Api\.SqlStorageProvider\<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory\>\.ApplyProviderSettings\(System\.Collections\.Generic\.IReadOnlyDictionary\<string,string\>\)\.settings')).ConfigureAwait(false);first.
If a derived implementation wants to take over the handling of one of the aforementioned common settings, it can do so before calling the base implementation and then remove the respective key from the dictionary before passing it to base.ApplyProviderSettings.
protected override System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyDictionary<string,string>> ApplyProviderSettings(System.Collections.Generic.IReadOnlyDictionary<string,string> settings);Parameters
Section titled “Parameters”settings System.Collections.Generic.IReadOnlyDictionary<System.String,System.String>
The settings to apply
Returns
Section titled “Returns”System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyDictionary<System.String,System.String>>
The remaining settings from settings that could not be applied to the storage provider.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.Close(TConnection, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.Close(TConnection, CancellationToken) Method”Override this method to perform all operations necessary to close down a connection asynchronously.
protected abstract System.Threading.Tasks.Task Close(TConnection connection, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Parameters
Section titled “Parameters”connection TConnection
The that should be closed
cancellationToken System.Threading.CancellationToken
Propagates a notification if the operations should be canceled.
Returns
Section titled “Returns”System.Threading.Tasks.Task
A System.Threading.Tasks.Task that completes when the has been closed.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ConfigureConnection(TConnection) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ConfigureConnection(TConnection) Method”Configures the given connection before it is opened, for example by assigning the connection string.
protected virtual void ConfigureConnection(TConnection connection);Parameters
Section titled “Parameters”connection TConnection
The connection to configure.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.CreateConnectionStringBuilder() Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.CreateConnectionStringBuilder() Method”Creates a provider-specific System.Data.Common.DbConnectionStringBuilder used to construct the connection string from configuration settings.
protected abstract System.Data.Common.DbConnectionStringBuilder CreateConnectionStringBuilder();Returns
Section titled “Returns”System.Data.Common.DbConnectionStringBuilder
A new System.Data.Common.DbConnectionStringBuilder instance.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ExecuteReader(TCommand, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ExecuteReader(TCommand, CancellationToken) Method”Executes the given command and returns the provider-specific data reader.
protected abstract System.Threading.Tasks.Task<TReader> ExecuteReader(TCommand command, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Parameters
Section titled “Parameters”command TCommand
The command to execute.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Threading.Tasks.Task<TReader>
A TReader positioned before the first row.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.Open(TConnection, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.Open(TConnection, CancellationToken) Method”Override this method to perform all operations necessary to establish a connection asynchronously.
protected abstract System.Threading.Tasks.Task Open(TConnection connection, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Parameters
Section titled “Parameters”connection TConnection
The that should be opened
cancellationToken System.Threading.CancellationToken
Propagates a notification if the operations should be canceled.
Returns
Section titled “Returns”System.Threading.Tasks.Task
A System.Threading.Tasks.Task that completes when the has been opened.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.PrepareCommand(TCommand, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.PrepareCommand(TCommand, CancellationToken) Method”Optionally call the provider-specific implementation of Prepare on the provided. Return a completed System.Threading.Tasks.Task if no preparation of commands is to be performed.
protected abstract System.Threading.Tasks.Task PrepareCommand(TCommand command, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Parameters
Section titled “Parameters”command TCommand
The to be prepared.
cancellationToken System.Threading.CancellationToken
Propagates a notification if the operations should be canceled.
Returns
Section titled “Returns”System.Threading.Tasks.Task
A System.Threading.Tasks.Task that completes when the has been prepared.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.PrepareConnection(CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.PrepareConnection(CancellationToken) Method”Creates and opens a new database connection, throwing on failure.
protected virtual System.Threading.Tasks.Task<TConnection> PrepareConnection(System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Parameters
Section titled “Parameters”cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Threading.Tasks.Task<TConnection>
An open TConnection.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.Read(TReader, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.Read(TReader, CancellationToken) Method”Advances the data reader to the next row.
protected abstract System.Threading.Tasks.Task<bool> Read(TReader reader, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Parameters
Section titled “Parameters”reader TReader
The data reader to advance.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Threading.Tasks.Task<System.Boolean>
true if there are more rows; otherwise, false.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadBool(TReader, int, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadBool(TReader, int, bool) Method”public bool ReadBool(TReader reader, int columnIndex, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadBool(TReader, int, bool, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadBool(TReader, int, bool, bool) Method”public bool ReadBool(TReader reader, int columnIndex, bool nullValue, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Boolean
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadBool(TReader, int, Nullable<bool>, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadBool(TReader, int, Nullable<bool>, bool) Method”public virtual System.Nullable<bool> ReadBool(TReader reader, int columnIndex, System.Nullable<bool> nullValue=null, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Nullable<System.Boolean>
validateColumnType System.Boolean
Returns
Section titled “Returns”System.Nullable<System.Boolean>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadByte(TReader, int, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadByte(TReader, int, bool) Method”public byte ReadByte(TReader reader, int columnIndex, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadByte(TReader, int, byte, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadByte(TReader, int, byte, bool) Method”public byte ReadByte(TReader reader, int columnIndex, byte nullValue, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Byte
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadByte(TReader, int, Nullable<byte>, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadByte(TReader, int, Nullable<byte>, bool) Method”public virtual System.Nullable<byte> ReadByte(TReader reader, int columnIndex, System.Nullable<byte> nullValue=null, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Nullable<System.Byte>
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadDateTime(TReader, int, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadDateTime(TReader, int, bool) Method”public System.DateTime ReadDateTime(TReader reader, int columnIndex, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadDateTime(TReader, int, DateTime, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadDateTime(TReader, int, DateTime, bool) Method”public System.DateTime ReadDateTime(TReader reader, int columnIndex, System.DateTime nullValue, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.DateTime
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadDateTime(TReader, int, Nullable<DateTime>, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadDateTime(TReader, int, Nullable<DateTime>, bool) Method”public virtual System.Nullable<System.DateTime> ReadDateTime(TReader reader, int columnIndex, System.Nullable<System.DateTime> nullValue=null, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Nullable<System.DateTime>
validateColumnType System.Boolean
Returns
Section titled “Returns”System.Nullable<System.DateTime>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadDecimal(TReader, int, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadDecimal(TReader, int, bool) Method”public decimal ReadDecimal(TReader reader, int columnIndex, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadDecimal(TReader, int, decimal, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadDecimal(TReader, int, decimal, bool) Method”public decimal ReadDecimal(TReader reader, int columnIndex, decimal nullValue, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Decimal
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadDecimal(TReader, int, Nullable<decimal>, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadDecimal(TReader, int, Nullable<decimal>, bool) Method”public virtual System.Nullable<decimal> ReadDecimal(TReader reader, int columnIndex, System.Nullable<decimal> nullValue=null, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Nullable<System.Decimal>
validateColumnType System.Boolean
Returns
Section titled “Returns”System.Nullable<System.Decimal>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadInt(TReader, int, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadInt(TReader, int, bool) Method”public int ReadInt(TReader reader, int columnIndex, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadInt(TReader, int, int, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadInt(TReader, int, int, bool) Method”public int ReadInt(TReader reader, int columnIndex, int nullValue, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Int32
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadInt(TReader, int, Nullable<int>, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadInt(TReader, int, Nullable<int>, bool) Method”public virtual System.Nullable<int> ReadInt(TReader reader, int columnIndex, System.Nullable<int> nullValue=null, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Nullable<System.Int32>
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadLong(TReader, int, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadLong(TReader, int, bool) Method”public long ReadLong(TReader reader, int columnIndex, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadLong(TReader, int, long, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadLong(TReader, int, long, bool) Method”public long ReadLong(TReader reader, int columnIndex, long nullValue, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Int64
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadLong(TReader, int, Nullable<long>, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadLong(TReader, int, Nullable<long>, bool) Method”public virtual System.Nullable<long> ReadLong(TReader reader, int columnIndex, System.Nullable<long> nullValue=null, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Nullable<System.Int64>
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadShort(TReader, int, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadShort(TReader, int, bool) Method”public short ReadShort(TReader reader, int columnIndex, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadShort(TReader, int, short, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadShort(TReader, int, short, bool) Method”public short ReadShort(TReader reader, int columnIndex, short nullValue, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Int16
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadShort(TReader, int, Nullable<short>, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadShort(TReader, int, Nullable<short>, bool) Method”public virtual System.Nullable<short> ReadShort(TReader reader, int columnIndex, System.Nullable<short> nullValue=null, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.Nullable<System.Int16>
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadString(TReader, int, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadString(TReader, int, bool) Method”public string ReadString(TReader reader, int columnIndex, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadString(TReader, int, string, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadString(TReader, int, string, bool) Method”public string ReadString(TReader reader, int columnIndex, string nullValue, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.String
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadStringAllowingNull(TReader, int, string, bool) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReadStringAllowingNull(TReader, int, string, bool) Method”public virtual string? ReadStringAllowingNull(TReader reader, int columnIndex, string? nullValue, bool validateColumnType=true);Parameters
Section titled “Parameters”reader TReader
columnIndex System.Int32
nullValue System.String
validateColumnType System.Boolean
Returns
Section titled “Returns”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReleaseConnection(TConnection, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReleaseConnection(TConnection, CancellationToken) Method”Releases and closes the given database connection.
protected virtual System.Threading.Tasks.Task ReleaseConnection(TConnection connection, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Parameters
Section titled “Parameters”connection TConnection
The connection to release.
cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Threading.Tasks.Task
A System.Threading.Tasks.Task that completes when the connection has been released.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReleaseConnectionQuietly(TConnection) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReleaseConnectionQuietly(TConnection) Method”Releases the given database connection as a cleanup backstop, logging and swallowing every failure so the cleanup cannot mask an original exception.
protected System.Threading.Tasks.Task ReleaseConnectionQuietly(TConnection connection);Parameters
Section titled “Parameters”connection TConnection
The connection to release.
Returns
Section titled “Returns”System.Threading.Tasks.Task
A System.Threading.Tasks.Task that completes when the release attempt has finished.
Remarks
Section titled “Remarks”Intended for finally blocks guarding ReleaseConnection(TConnection, CancellationToken): it uses System.Threading.CancellationToken.None so the cleanup also runs when the caller’s token is already canceled. Only call it when the normal-path release was never attempted, because ReleaseConnection(TConnection, CancellationToken) overrides may not be idempotent.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReplaceOrEscapeWildcard(string) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ReplaceOrEscapeWildcard(string) Method”Escapes SQL wildcard characters (%, _) in the given
query string and translates user-facing wildcards
(*, ?) to their SQL equivalents.
public virtual string ReplaceOrEscapeWildcard(string query);Parameters
Section titled “Parameters”query System.String
The search pattern to transform.
Implements ReplaceOrEscapeWildcard(string)
Returns
Section titled “Returns”System.String
A SQL-safe LIKE pattern with wildcards properly escaped or translated.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ThrowColumnIsNullException<TResult>(TReader, int) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.ThrowColumnIsNullException<TResult>(TReader, int) Method”protected TResult ThrowColumnIsNullException<TResult>(TReader reader, int columnindex);Type parameters
Section titled “Type parameters”TResult
Parameters
Section titled “Parameters”reader TReader
columnindex System.Int32
Returns
Section titled “Returns”Exceptions
Section titled “Exceptions”SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TryCreateCommand(TConnection) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TryCreateCommand(TConnection) Method”Creates a TCommand from the given connection, returning an error if the command type does not match.
protected virtual HAKOM.ErrorHandling.Core.Net.Api.Result<TCommand> TryCreateCommand(TConnection connection);Parameters
Section titled “Parameters”connection TConnection
The connection to create the command from.
Returns
Section titled “Returns”HAKOM.ErrorHandling.Core.Net.Api.Result<TCommand>
A Result<TValue> containing the command, or an error if the connection returned an unexpected type.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TryExecute(string, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TryExecute(string, CancellationToken) Method”Attempts to execute the specified SQL statement and returns a Result<TValue> containing the number of affected rows or an error.
public virtual System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<int>> TryExecute(string sql, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Parameters
Section titled “Parameters”sql System.String
The SQL statement to execute.
cancellationToken System.Threading.CancellationToken
Propagates notification that the operation should be canceled.
Implements TryExecute(string, CancellationToken)
Returns
Section titled “Returns”System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<System.Int32>>
A Result<TValue> with the number of affected rows on success, or an error on failure.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TryExecute(string, CancellationToken, TParameter[]) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TryExecute(string, CancellationToken, TParameter[]) Method”public virtual 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
cancellationToken System.Threading.CancellationToken
parameters TParameter[]
Returns
Section titled “Returns”System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<System.Int32>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TryHandleFailedConnectionAttempt(TConnection, Exception, Result<TConnection>) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TryHandleFailedConnectionAttempt(TConnection, Exception, Result<TConnection>) Method”Allows derived providers to handle a failed connection attempt and optionally return a recovery result.
protected virtual bool TryHandleFailedConnectionAttempt(TConnection connection, System.Exception exception, out HAKOM.ErrorHandling.Core.Net.Api.Result<TConnection> handledResult);Parameters
Section titled “Parameters”connection TConnection
The connection that failed to open.
exception System.Exception
The exception that occurred during the connection attempt.
handledResult HAKOM.ErrorHandling.Core.Net.Api.Result<TConnection>
When this method returns true, contains the recovery result.
Returns
Section titled “Returns”System.Boolean
true if the failure was handled; otherwise, false.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TryPrepareConnection(CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TryPrepareConnection(CancellationToken) Method”Creates and opens a new database connection, returning a Result<TValue> on failure instead of throwing.
protected virtual System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<TConnection>> TryPrepareConnection(System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Parameters
Section titled “Parameters”cancellationToken System.Threading.CancellationToken
A token to cancel the operation.
Returns
Section titled “Returns”System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<TConnection>>
A Result<TValue> containing the open connection or an error.
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, bool, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, bool, CancellationToken) Method”public 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
Parameters
Section titled “Parameters”sql System.String
parameters System.Collections.Generic.IEnumerable<TParameter>
parser System.Func<TReader,System.Threading.Tasks.Task<TResult>>
abortOnParseError System.Boolean
cancellationToken System.Threading.CancellationToken
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, CancellationToken) Method”public 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
Parameters
Section titled “Parameters”sql System.String
parameters System.Collections.Generic.IEnumerable<TParameter>
parser System.Func<TReader,System.Threading.Tasks.Task<TResult>>
cancellationToken System.Threading.CancellationToken
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, bool, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, bool, CancellationToken) Method”public 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
Parameters
Section titled “Parameters”sql System.String
parameters System.Collections.Generic.IEnumerable<TParameter>
parser System.Func<TReader,TResult>
abortOnParseError System.Boolean
cancellationToken System.Threading.CancellationToken
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, CancellationToken) Method”public 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
Parameters
Section titled “Parameters”sql System.String
parameters System.Collections.Generic.IEnumerable<TParameter>
parser System.Func<TReader,TResult>
cancellationToken System.Threading.CancellationToken
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, Func<TReader,Task<TResult>>, bool, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, Func<TReader,Task<TResult>>, bool, CancellationToken) Method”public System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>> TrySelect<TResult>(string sql, 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
Parameters
Section titled “Parameters”sql System.String
parser System.Func<TReader,System.Threading.Tasks.Task<TResult>>
abortOnParseError System.Boolean
cancellationToken System.Threading.CancellationToken
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, Func<TReader,Task<TResult>>, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, Func<TReader,Task<TResult>>, CancellationToken) Method”public System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>> TrySelect<TResult>(string sql, System.Func<TReader,System.Threading.Tasks.Task<TResult>> parser, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
Parameters
Section titled “Parameters”sql System.String
parser System.Func<TReader,System.Threading.Tasks.Task<TResult>>
cancellationToken System.Threading.CancellationToken
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, Func<TReader,TResult>, bool, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, Func<TReader,TResult>, bool, CancellationToken) Method”public System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>> TrySelect<TResult>(string sql, System.Func<TReader,TResult> parser, bool abortOnParseError, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
Parameters
Section titled “Parameters”sql System.String
parser System.Func<TReader,TResult>
abortOnParseError System.Boolean
cancellationToken System.Threading.CancellationToken
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, Func<TReader,TResult>, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelect<TResult>(string, Func<TReader,TResult>, CancellationToken) Method”public System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>> TrySelect<TResult>(string sql, System.Func<TReader,TResult> parser, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
Parameters
Section titled “Parameters”sql System.String
parser System.Func<TReader,TResult>
cancellationToken System.Threading.CancellationToken
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelectFirst<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelectFirst<TResult>(string, IEnumerable<TParameter>, Func<TReader,Task<TResult>>, CancellationToken) Method”public 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
Parameters
Section titled “Parameters”sql System.String
parameters System.Collections.Generic.IEnumerable<TParameter>
parser System.Func<TReader,System.Threading.Tasks.Task<TResult>>
cancellationToken System.Threading.CancellationToken
Returns
Section titled “Returns”System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelectFirst<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelectFirst<TResult>(string, IEnumerable<TParameter>, Func<TReader,TResult>, CancellationToken) Method”public 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
Parameters
Section titled “Parameters”sql System.String
parameters System.Collections.Generic.IEnumerable<TParameter>
parser System.Func<TReader,TResult>
cancellationToken System.Threading.CancellationToken
Returns
Section titled “Returns”System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelectFirst<TResult>(string, Func<TReader,Task<TResult>>, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelectFirst<TResult>(string, Func<TReader,Task<TResult>>, CancellationToken) Method”public System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>> TrySelectFirst<TResult>(string sql, System.Func<TReader,System.Threading.Tasks.Task<TResult>> parser, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
Parameters
Section titled “Parameters”sql System.String
parser System.Func<TReader,System.Threading.Tasks.Task<TResult>>
cancellationToken System.Threading.CancellationToken
Returns
Section titled “Returns”System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelectFirst<TResult>(string, Func<TReader,TResult>, CancellationToken) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.TrySelectFirst<TResult>(string, Func<TReader,TResult>, CancellationToken) Method”public System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>> TrySelectFirst<TResult>(string sql, System.Func<TReader,TResult> parser, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Type parameters
Section titled “Type parameters”TResult
Parameters
Section titled “Parameters”sql System.String
parser System.Func<TReader,TResult>
cancellationToken System.Threading.CancellationToken
Returns
Section titled “Returns”System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<TResult>>
SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.WrapDbException(string, DbException, LogLevel) Method
Section titled “SqlStorageProvider<TConnection,TCommand,TNativeParameter,TReader,TParameter,TParameterFactory>.WrapDbException(string, DbException, LogLevel) Method”Wraps a provider-specific System.Data.Common.DbException in an appropriate HakomException.
protected virtual HAKOM.ErrorHandling.Core.Net.Api.HakomException WrapDbException(string sql, System.Data.Common.DbException innerException, Microsoft.Extensions.Logging.LogLevel logLevel=Microsoft.Extensions.Logging.LogLevel.None);Parameters
Section titled “Parameters”sql System.String
The SQL statement that caused the exception.
innerException System.Data.Common.DbException
The original database exception.
logLevel Microsoft.Extensions.Logging.LogLevel
The Microsoft.Extensions.Logging.LogLevel severity at which the exception will be thrown.
Returns
Section titled “Returns”HakomException
A HakomException wrapping the database error.