Class SqlDatabaseHandler
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Data.Providers
Assembly: EPiServer.Data.dll
Version: 7.19.2Syntax
public class SqlDatabaseHandler : IDatabaseHandler
Remarks
Implements IDatabaseHandler and is not thread-safe, purpose is to use it during a session for access to SQL Server.
Constructors
SqlDatabaseHandler(ConnectionStringSettings, Int32, TimeSpan, TimeSpan)
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
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
This class supports the EPiServer infrastructure and is not intended to be used directly from your code. The current connection
Declaration
public 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
This class supports the EPiServer infrastructure and is not intended to be used directly from your code. The connection settings containing the connection string
Declaration
public ConnectionStringSettings ConnectionSettings { get; }
Property Value
| Type | Description |
|---|---|
| System.Configuration.ConnectionStringSettings |
DatabaseQueryTimeout
This class supports the EPiServer infrastructure and is not intended to be used directly from your code. The timeout for command objects created by this classes
Declaration
public TimeSpan DatabaseQueryTimeout { get; set; }
Property Value
| Type | Description |
|---|---|
| System.TimeSpan |
DbFactory
This class supports the EPiServer infrastructure and is not intended to be used directly from your code. Underlying factory used to create data access objects
Declaration
public DbProviderFactory DbFactory { get; }
Property Value
| Type | Description |
|---|---|
| System.Data.Common.DbProviderFactory |
IsInTransaction
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
Declaration
public bool IsInTransaction { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Transaction
This class supports the EPiServer infrastructure and is not intended to be used directly from your code. The current transaction if one exist
Declaration
public DbTransaction Transaction { get; }
Property Value
| Type | Description |
|---|---|
| System.Data.Common.DbTransaction |
Methods
AcquireLock(String)
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()
Asserts that the call was made from the same thread as the databasehandler object was instantiated in.
Declaration
protected virtual void AssertThreadSafe()
CreateCommand()
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
Declaration
public virtual DbCommand CreateCommand()
Returns
| Type | Description |
|---|---|
| System.Data.Common.DbCommand |
CreateCommand(String, CommandType, Object[])
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
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()
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
Declaration
public virtual DbConnection CreateConnection()
Returns
| Type | Description |
|---|---|
| System.Data.Common.DbConnection |
CreateParametersAndSetValues(DbCommand, Object[])
This class supports the EPiServer infrastructure and is not intended to be used directly from your code. 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)
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
Declaration
public virtual string EscapeWildcardChars(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value |
Returns
| Type | Description |
|---|---|
| System.String |
Execute(Action)
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
Declaration
public virtual void Execute(Action action)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Action | action |
Execute<TResult>(Func<TResult>)
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
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 |
ExecuteLocked(String, Action)
Executes an action with acuiring an exclusive lock for specified resource.
Declaration
public void ExecuteLocked(string resourceName, Action action)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | resourceName | Name of the resource. |
| System.Action | action | The action. |
ExecuteLocked<TResult>(String, Func<TResult>)
Declaration
public 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)
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
Declaration
public virtual void ExecuteTransaction(Action action)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Action | action |
ExecuteTransaction<TResult>(Func<TResult>)
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
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 |
GetConnection(Boolean)
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
Declaration
public IConnectionScope GetConnection(bool requireTransaction)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | requireTransaction | If a transaction is required, if one exist it will always be re-used |
Returns
| Type | Description |
|---|---|
| IConnectionScope | This method opens a new connection if one does not exist |
GetLockOwner()
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)
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
Declaration
public virtual string GetProviderSpecificParameterName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name |
Returns
| Type | Description |
|---|---|
| System.String |
ReleaseLock(String)
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)
This class supports the EPiServer infrastructure and is not intended to be used directly from your code.
Declaration
public virtual void SetExternalTransaction(DbTransaction transaction)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.Common.DbTransaction | transaction |