Table of Contents

Class SqlDataManager

Namespace
Cuemon.Data.SqlClient
Assembly
Cuemon.Data.SqlClient.dll

The SqlDataManager is the primary class of the Cuemon.Data.SqlClient namespace that can be used to execute commands targeted Microsoft SQL Server.

public class SqlDataManager : DataManager, IConfigurable<DataManagerOptions>
Inheritance
SqlDataManager
Implements
Inherited Members

Constructors

SqlDataManager(Action<DataManagerOptions>)

Initializes a new instance of the SqlDataManager class.

public SqlDataManager(Action<DataManagerOptions> setup)

Parameters

setup Action<DataManagerOptions>

The DataManagerOptions which need to be configured.

Properties

TransientFaultHandlingOptionsCallback

Gets or sets the callback delegate that will provide options for transient fault handling.

public Action<TransientOperationOptions> TransientFaultHandlingOptionsCallback { get; set; }

Property Value

Action<TransientOperationOptions>

An Action<T> with the options for transient fault handling.

Remarks

This implementation is compatible with transient related faults on Microsoft SQL Azure.
Microsoft SQL Server is supported as well.

Methods

Clone()

Creates a new object that is a copy of the current instance.

public override DataManager Clone()

Returns

DataManager

A new object that is a copy of this instance.

ExecuteCommand<T>(DataStatement, Func<IDbCommand, T>)

Core method for executing methods on the DbCommand object resolved from the virtual Cuemon.Data.DataManager.ExecuteCommandCore(Cuemon.Data.DataCommand,System.Data.Common.IDbDataParameter[]) method.

protected override T ExecuteCommand<T>(DataStatement statement, Func<IDbCommand, T> executeSelector)

Parameters

statement DataStatement

The command statement to execute.

executeSelector Func<IDbCommand, T>

The function delegate that will invoke a method on the resolved DbCommand from the virtual Cuemon.Data.DataManager.ExecuteCommandCore(Cuemon.Data.DataCommand,System.Data.Common.IDbDataParameter[]) method.

Returns

T

A value of T that is equal to the invoked method of the DbCommand object.

Type Parameters

T

The type to return.

Remarks

If TransientFaultHandlingOptionsCallback is null, no SQL operation is wrapped inside a transient fault handling operation. Otherwise, if TransientFaultHandlingOptionsCallback has the EnableRecovery set to true, this method will, with it's default implementation, try to gracefully recover from transient faults when the following condition is met:
RetryAttempts is less than the current attempt starting from 1 with a maximum of MaxValue retries
DetectionStrategy must evaluate to true
In case of a transient failure the default implementation will use RetryStrategy.
In any other case the originating exception is thrown.

ExecuteIdentityDecimal(DataStatement)

Executes the command statement and returns an identity value as decimal.

public decimal ExecuteIdentityDecimal(DataStatement statement)

Parameters

statement DataStatement

The command statement to execute.

Returns

Decimal

Decimal

Exceptions

ArgumentNullException

statement cannot be null.

ExecuteIdentityInt32(DataStatement)

Executes the command statement and returns an identity value as int.

public int ExecuteIdentityInt32(DataStatement statement)

Parameters

statement DataStatement

The command statement to execute.

Returns

Int32

Int32

Exceptions

ArgumentNullException

statement cannot be null.

ExecuteIdentityInt64(DataStatement)

Executes the command statement and returns an identity value as long.

public long ExecuteIdentityInt64(DataStatement statement)

Parameters

statement DataStatement

The command statement to execute.

Returns

Int64

Int64

Exceptions

ArgumentNullException

statement cannot be null.

GetDbCommand(DataStatement)

Gets the command object used by all execute related methods.

protected override IDbCommand GetDbCommand(DataStatement statement)

Parameters

statement DataStatement

The command statement to execute.

Returns

IDbCommand

A a new SqlCommand instance.

Exceptions

ArgumentNullException

statement cannot be null.