SqlDataManager Class
Definition
- Assemblies
- 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
Examples
The following example demonstrates how to configure SqlDataManager with a Microsoft SQL Server connection string, inspect its transient fault handling callback, and clone the manager instance.
// Program.cs
using System;
using Cuemon.Data.SqlClient;
var manager = new SqlDataManager(o =>
{
o.ConnectionString = "Server=.;Database=AdventureWorks;Trusted_Connection=True;TrustServerCertificate=True;";
});
var cloned = (SqlDataManager)manager.Clone();
Console.WriteLine($"Connection string: {manager.Options.ConnectionString}");
Console.WriteLine($"Transient fault callback configured: {manager.TransientFaultHandlingOptionsCallback is not null}");
Console.WriteLine($"Cloned connection string matches: {cloned.Options.ConnectionString == manager.Options.ConnectionString}");
Constructors
| Name | Description |
|---|---|
| SqlDataManager(Action<DataManagerOptions>) | Initializes a new instance of the SqlDataManager class. |
Properties
| Name | Description |
|---|---|
| TransientFaultHandlingOptionsCallback | Gets or sets the callback delegate that will provide options for transient fault handling. |
Methods
| Name | Description |
|---|---|
| Clone() | Creates a new object that is a copy of the current instance. |
| ExecuteCommand<T>(DataStatement, Func<IDbCommand, T>) | Core method for executing methods on the DbCommand object resolved from the virtual execute command workflow on DataManager. |
| ExecuteIdentityDecimal(DataStatement) | Executes the command statement and returns an identity value as decimal. |
| ExecuteIdentityInt32(DataStatement) | Executes the command statement and returns an identity value as int. |
| ExecuteIdentityInt64(DataStatement) | Executes the command statement and returns an identity value as long. |
| GetDbCommand(DataStatement) | Gets the command object used by all execute related methods. |