MySQL · Types · Services and connections
ArxMySqlConnection
Definition
- Namespace
ARX.SDK.MySQL.Services- Package
ARX.SDK.MySQL
public sealed class ArxMySqlConnection : ArxConnectionA MySQL connection for ARX transactions. Application code begins a transaction on it and passes the transaction to ArxMySqlDbService calls; it never needs a MySqlConnector type.
Constructor
ArxMySqlConnection(string connectionString)A connection for ARX transactions. It opens with the first BeginTransactionAsync.
Parameter Type Description connectionStringstringThe MySqlConnector connection string.
Usage
A line from a verified sample; the full, runnable code is on its page.
await using (var connection = new ArxMySqlConnection(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 a MySqlConnection, 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 (the session time zone UTC and a strict SQL mode, stated once when it opens), and closes on dispose. Its transactions have the server's default isolation level (REPEATABLE READ unless the server says otherwise). One transaction at a time, and one call at a time. Not thread-safe.