SQL Server · Types · Services and connections
ArxMsSqlConnection
Definition
- Namespace
ARX.SDK.SQL.Services- Package
ARX.SDK.SQL
public sealed class ArxMsSqlConnection : ArxConnectionA 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
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:
- Several calls in one ARX transaction: commit or roll backCreate
- Updates in one ARX transaction: commit, roll back, abortUpdate
- Deletes in one ARX transaction: roll back or commitDeleteMultiple
- Read your own writes in an ARX transactionRetrieve
- A nightly job that commits in batchesExecute
- Execute in an ARX transactionExecute
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.