November Happy Hour will be moved to Thursday December 5th.

Class SqlDatabaseHandler

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Inheritance
System.Object
SqlDatabaseHandler
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Data.Providers
Assembly: EPiServer.Data.dll
Version: 9.12.2
Syntax
public class SqlDatabaseHandler : IAsyncDatabaseHandler, IDatabaseHandler

Constructors

SqlDatabaseHandler(ConnectionStringSettings, Int32, TimeSpan, TimeSpan)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public SqlDatabaseHandler(ConnectionStringSettings connectionStringSettings, int retries, TimeSpan retryDelay, TimeSpan databaseQueryTimeout)
Parameters
Type Name Description
System.Configuration.ConnectionStringSettings connectionStringSettings

Settings containing the connection string used

System.Int32 retries

The number of retries, 0 means no retries

System.TimeSpan retryDelay

The delay between each retry

System.TimeSpan databaseQueryTimeout

The timeout for executing commands

Properties

Connection

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. The current connection

Declaration
public virtual DbConnection Connection { get; }
Property Value
Type Description
System.Data.Common.DbConnection
Remarks

The connection can change if an nested transaction is created inside a non-transacted call

ConnectionSettings

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. The connection settings containing the connection string

Declaration
public virtual ConnectionStringSettings ConnectionSettings { get; }
Property Value
Type Description
System.Configuration.ConnectionStringSettings

DatabaseQueryTimeout

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. The timeout for command objects created by this classes

Declaration
public TimeSpan DatabaseQueryTimeout { get; set; }
Property Value
Type Description
System.TimeSpan

DbFactory

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Underlying factory used to create data access objects

Declaration
public virtual DbProviderFactory DbFactory { get; }
Property Value
Type Description
System.Data.Common.DbProviderFactory

IsInTransaction

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual bool IsInTransaction { get; }
Property Value
Type Description
System.Boolean

Transaction

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. The current transaction if one exist

Declaration
public DbTransaction Transaction { get; }
Property Value
Type Description
System.Data.Common.DbTransaction

Methods

AcquireLock(String)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Acquires an exclusive lock for specified resource

Declaration
protected virtual void AcquireLock(string resourceName)
Parameters
Type Name Description
System.String resourceName

Name of the resource.

Exceptions
Type Condition
System.InvalidOperationException

Exception is thrown if operation was failed.

AssertThreadSafe()

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Asserts that the call was made from the same thread as the databasehandler object was instantiated in.

Declaration
protected virtual void AssertThreadSafe()

CreateCommand()

Declaration
public virtual DbCommand CreateCommand()
Returns
Type Description
System.Data.Common.DbCommand

CreateCommand(String, CommandType, Object[])

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual DbCommand CreateCommand(string commandText, CommandType commandType, params object[] parameterValues)
Parameters
Type Name Description
System.String commandText
System.Data.CommandType commandType
System.Object[] parameterValues
Returns
Type Description
System.Data.Common.DbCommand

CreateConnection()

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual DbConnection CreateConnection()
Returns
Type Description
System.Data.Common.DbConnection

CreateParametersAndSetValues(DbCommand, Object[])

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Automatically populates the parameters collection of the command and assigns the provided parameter values

Declaration
public static void CreateParametersAndSetValues(DbCommand command, object[] parameterValues)
Parameters
Type Name Description
System.Data.Common.DbCommand command

The command to create a parameters collection for

System.Object[] parameterValues

The parameter values to assign to the parameter collection of the command

Remarks

The command must have an associated connection, any null values in parameterValues will be replaced by DBNull

EscapeWildcardChars(String)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual string EscapeWildcardChars(string value)
Parameters
Type Name Description
System.String value
Returns
Type Description
System.String

Execute(Action)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual void Execute(Action action)
Parameters
Type Name Description
System.Action action

Execute<TResult>(Func<TResult>)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual TResult Execute<TResult>(Func<TResult> action)
Parameters
Type Name Description
System.Func<TResult> action
Returns
Type Description
TResult
Type Parameters
Name Description
TResult

ExecuteAsync(Func<Task>)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual Task ExecuteAsync(Func<Task> action)
Parameters
Type Name Description
System.Func<System.Threading.Tasks.Task> action
Returns
Type Description
System.Threading.Tasks.Task

ExecuteAsync<TResult>(Func<Task<TResult>>)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual Task<TResult> ExecuteAsync<TResult>(Func<Task<TResult>> action)
Parameters
Type Name Description
System.Func<System.Threading.Tasks.Task<TResult>> action
Returns
Type Description
System.Threading.Tasks.Task<TResult>
Type Parameters
Name Description
TResult

ExecuteLocked(String, Action)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual void ExecuteLocked(string resourceName, Action action)
Parameters
Type Name Description
System.String resourceName
System.Action action

ExecuteLocked<TResult>(String, Func<TResult>)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual TResult ExecuteLocked<TResult>(string resourceName, Func<TResult> action)
Parameters
Type Name Description
System.String resourceName
System.Func<TResult> action
Returns
Type Description
TResult
Type Parameters
Name Description
TResult

ExecuteTransaction(Action)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual void ExecuteTransaction(Action action)
Parameters
Type Name Description
System.Action action

ExecuteTransaction<TResult>(Func<TResult>)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual TResult ExecuteTransaction<TResult>(Func<TResult> action)
Parameters
Type Name Description
System.Func<TResult> action
Returns
Type Description
TResult
Type Parameters
Name Description
TResult

ExecuteTransactionAsync(Func<Task>)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual Task ExecuteTransactionAsync(Func<Task> action)
Parameters
Type Name Description
System.Func<System.Threading.Tasks.Task> action
Returns
Type Description
System.Threading.Tasks.Task

ExecuteTransactionAsync<TResult>(Func<Task<TResult>>)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual Task<TResult> ExecuteTransactionAsync<TResult>(Func<Task<TResult>> action)
Parameters
Type Name Description
System.Func<System.Threading.Tasks.Task<TResult>> action
Returns
Type Description
System.Threading.Tasks.Task<TResult>
Type Parameters
Name Description
TResult

GetAsyncConnection(Boolean)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual Task<IAsyncConnectionScope> GetAsyncConnection(bool requireTransaction)
Parameters
Type Name Description
System.Boolean requireTransaction
Returns
Type Description
System.Threading.Tasks.Task<IAsyncConnectionScope>

GetConnection(Boolean)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual IConnectionScope GetConnection(bool requireTransaction)
Parameters
Type Name Description
System.Boolean requireTransaction
Returns
Type Description
IConnectionScope

GetLockOwner()

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the lock owner depending on current scope.

Declaration
protected virtual string GetLockOwner()
Returns
Type Description
System.String

Transaction if executed in transaction or Session if there is no active transaction at the moment.

GetProviderSpecificParameterName(String)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual string GetProviderSpecificParameterName(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
System.String

ReleaseLock(String)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Releases the lock for specified resource.

Declaration
protected virtual void ReleaseLock(string resourceName)
Parameters
Type Name Description
System.String resourceName

Name of the resource.

Exceptions
Type Condition
System.InvalidOperationException

Exception is thrown if operation was failed.

SetExternalTransaction(DbTransaction)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual void SetExternalTransaction(DbTransaction transaction)
Parameters
Type Name Description
System.Data.Common.DbTransaction transaction

Implements

Extension Methods