SQL Server · Types · Services and connections

ArxMsSqlConnection

Definition

Namespace
ARX.SDK.SQL.Services
Package
ARX.SDK.SQL
C#
public sealed class ArxMsSqlConnection : ArxConnection

A SQL Server connection for ARX transactions. Application code begins a transaction on it and passes the transaction to ArxMsSqlDbService calls; it never needs a Microsoft.Data.SqlClient type.

Constructor

  • ArxMsSqlConnection(string connectionString)

    A connection for ARX transactions. It opens with the first BeginTransactionAsync.

    Parameter Type Description
    connectionStringstringThe Microsoft.Data.SqlClient connection string.

Usage

C#

A line from a verified sample; the full, runnable code is on its page.

await using (var connection = new ArxMsSqlConnection(dbContext.ConnectionString))

Several calls in one ARX transaction: commit or roll back, scenario 1

Used in:

Notes

It wraps an SqlConnection, which is sealed, so ARX can't derive from it. The connection opens on the first BeginTransactionAsync, with the session defaults of every connection ARX opens (SQL Server has no session time zone; XACT_ABORT stays off so a failed statement leaves the transaction usable for batch-scope savepoints), and closes on dispose. One transaction at a time, and one call at a time. Not thread-safe.