SQL Server · Types · Other public types
IArxDataService
Definition
- Namespace
ARX.SDK.Services- Package
ARX.SDK
public interface IArxDataService : IArxBatchDataServiceWhat every ARX service does, whatever its database: the operations, the capabilities, the startup checks, and batch scopes for work that must succeed or fail together. Application code can depend on it, register the provider behind it, and mock it in tests: services.AddSingleton<IArxDataService>(new ArxMsSqlDbService(connectionString, schema)); The provider types add what is theirs (connections, transactions, options); a call the provider can't do is refused with ARX8001 NotSupported, as Capabilities says (ExecuteAsync on MongoDB and DynamoDB).
Properties
IArxProviderCapabilities Capabilities { get; }What the provider supports: a call outside it is ARX8001.
Methods
Task<ArxServerCheck> CheckServerAsync(CancellationToken cancellationToken = default)What the connected server allows: its version, the capabilities it removes and why.
Parameter Type Description cancellationTokenCancellationToken= defaultCancels the call. Task ValidateSchemaAsync(CancellationToken cancellationToken = default)Compares every table of the schema catalog with the database, and throws with the differences.
Parameter Type Description cancellationTokenCancellationToken= defaultCancels the call. Task<ArxTransaction> BeginTransactionAsync(CancellationToken cancellationToken = default)Begins a transaction on a connection of its own, the same way on every provider: pass the transaction to the calls, then commit it. Disposing it without committing rolls it back, and closes its connection (
await using var transaction = await service.BeginTransactionAsync();).Parameter Type Description cancellationTokenCancellationToken= defaultCancels the call. Task<int> UpdateMultipleAsync(ArxEntity values, ArxFilterExpression filter, ArxFilterWriteOptions? options = null, CancellationToken cancellationToken = default)Sets
values' attributes on every row of its table thatfiltermatches, in one call, and returns how many rows changed.UPDATE … SET … WHERE …on the SQL databases.Parameter Type Description valuesArxEntityThe table (EntityName) and the attributes to set: null clears a column. filterArxFilterExpressionThe rows to change: conditions on the table's own columns. optionsArxFilterWriteOptions?= nullAllRows for an empty filter; null for the defaults. cancellationTokenCancellationToken= defaultCancels the call. Task<int> UpdateMultipleAsync(ArxEntity values, ArxFilterExpression filter, ArxTransaction transaction, ArxFilterWriteOptions? options = null, CancellationToken cancellationToken = default)The update by a filter inside an ARX transaction (see
UpdateMultipleAsync).Parameter Type Description valuesArxEntityThe table (EntityName) and the attributes to set: null clears a column. filterArxFilterExpressionThe rows to change: conditions on the table's own columns. transactionArxTransactionThe ARX transaction to run in. ARX doesn't commit or roll it back. optionsArxFilterWriteOptions?= nullAllRows for an empty filter; null for the defaults. cancellationTokenCancellationToken= defaultCancels the call. Task<int> DeleteMultipleAsync(string entityName, ArxFilterExpression filter, ArxFilterWriteOptions? options = null, CancellationToken cancellationToken = default)Deletes every row of the table that
filtermatches, in one call, and returns how many went. The filter's rules are UpdateMultiple's: the table's own columns, and an empty filter is ARX1001 unlessAllRowsis set.Parameter Type Description entityNamestringThe table to delete from. filterArxFilterExpressionThe rows to delete: conditions on the table's own columns. optionsArxFilterWriteOptions?= nullAllRows for an empty filter; null for the defaults. cancellationTokenCancellationToken= defaultCancels the call. Task<int> DeleteMultipleAsync(string entityName, ArxFilterExpression filter, ArxTransaction transaction, ArxFilterWriteOptions? options = null, CancellationToken cancellationToken = default)The delete by a filter inside an ARX transaction (see
DeleteMultipleAsync).Parameter Type Description entityNamestringThe table to delete from. filterArxFilterExpressionThe rows to delete: conditions on the table's own columns. transactionArxTransactionThe ARX transaction to run in. ARX doesn't commit or roll it back. optionsArxFilterWriteOptions?= nullAllRows for an empty filter; null for the defaults. cancellationTokenCancellationToken= defaultCancels the call. Task<IReadOnlyList<ArxRecordId>> CreateMultipleAsync(IReadOnlyList<ArxEntity> entities, ArxCreateMultipleOptions options, CancellationToken cancellationToken = default)Creates the records, all or nothing, as
CreateMultipleAsync, with options. WithReturnIdsfalse no id is read back: the provider can take its bulk path, a table without a usable id is created without a catalog, and every id returned isNone.Parameter Type Description entitiesIReadOnlyList<ArxEntity>The records to create, all or nothing. optionsArxCreateMultipleOptionsReturnIds false to skip reading the ids back. cancellationTokenCancellationToken= defaultCancels the call. Task<IReadOnlyList<ArxRecordId>> CreateMultipleAsync(IReadOnlyList<ArxEntity> entities, ArxCreateMultipleOptions options, ArxTransaction transaction, CancellationToken cancellationToken = default)CreateMultiple with options inside an ARX transaction (see
CreateMultipleAsync).Parameter Type Description entitiesIReadOnlyList<ArxEntity>The records to create, all or nothing. optionsArxCreateMultipleOptionsReturnIds false to skip reading the ids back. transactionArxTransactionThe ARX transaction to run in. ARX doesn't commit or roll it back. cancellationTokenCancellationToken= defaultCancels the call. Task<ArxRecordId> CreateAsync(ArxEntity entity, CancellationToken cancellationToken = default)Creates one record and returns its id (also set on
RecordId).Parameter Type Description entityArxEntityThe record to create: its table and the attributes to write. Its RecordIdis set to the new id.cancellationTokenCancellationToken= defaultCancels the call. Task<IReadOnlyList<ArxRecordId>> CreateMultipleAsync(IReadOnlyList<ArxEntity> entities, CancellationToken cancellationToken = default)Creates the records, all or nothing, and returns their ids in the order of the list.
Parameter Type Description entitiesIReadOnlyList<ArxEntity>The records to create, all or nothing; their ids come back in the same order. cancellationTokenCancellationToken= defaultCancels the call. Task<int> UpdateAsync(ArxEntity entity, ArxUpdateOptions? options = null, CancellationToken cancellationToken = default)Updates the records the entity finds (by its id, or the match of the options) and returns how many: 1 by id or a key; by columns every row that matches unless RequireSingleRow. None is ARX2002.
Parameter Type Description entityArxEntityThe change: its table, the attributes to write (null clears a column; an attribute left out keeps its value), and the id, key or columns that find the row. optionsArxUpdateOptions?= nullHow the rows are found ( Match) and checked; null for the defaults (by id).cancellationTokenCancellationToken= defaultCancels the call. Task<int> UpdateMultipleAsync(IReadOnlyList<ArxEntity> entities, ArxUpdateOptions? options = null, CancellationToken cancellationToken = default)Updates every entity's record, all or nothing, and returns how many; one that finds none is ARX2002.
Parameter Type Description entitiesIReadOnlyList<ArxEntity>The changes, all or nothing: each carries the attributes to write and what finds its row. optionsArxUpdateOptions?= nullHow the rows are found ( Match) and checked; null for the defaults (by id).cancellationTokenCancellationToken= defaultCancels the call. Task<bool> DeleteAsync(string entityName, ArxRecordId id, CancellationToken cancellationToken = default)Deletes the record with this id: true when it was there.
Parameter Type Description entityNamestringThe table to delete from. idArxRecordIdThe record's id: the value Create returned, or a plain value of the declared id's type. cancellationTokenCancellationToken= defaultCancels the call. Task<int> DeleteAsync(ArxEntity entity, ArxDeleteOptions? options = null, CancellationToken cancellationToken = default)Deletes the records the entity finds and returns how many (0 when none; ARX2002 with RequireSingleRow).
Parameter Type Description entityArxEntityThe record to delete: its table and the id, key or columns that find it. optionsArxDeleteOptions?= nullHow the rows are found ( Match) and checked; null for the defaults (by id).cancellationTokenCancellationToken= defaultCancels the call. Task<int> DeleteMultipleAsync(IReadOnlyList<ArxEntity> entities, ArxDeleteOptions? options = null, CancellationToken cancellationToken = default)Deletes the records the entities find, all or nothing, and returns how many existed.
Parameter Type Description entitiesIReadOnlyList<ArxEntity>The records to delete, all or nothing, each found by its id or by the match's columns. optionsArxDeleteOptions?= nullHow the rows are found ( Match) and checked; null for the defaults (by id).cancellationTokenCancellationToken= defaultCancels the call. Task<ArxEntity?> RetrieveAsync(string entityName, ArxRecordId id, ArxColumnSet? columns = null, CancellationToken cancellationToken = default)Reads one record by id, the columns given (all when null); null when it isn't there.
Parameter Type Description entityNamestringThe table or view to read. idArxRecordIdThe record's id: the value Create returned, or a plain value of the declared id's type. columnsArxColumnSet?= nullThe columns to read; null or an empty set reads every column. The declared id is always read. cancellationTokenCancellationToken= defaultCancels the call. Task<ArxEntityCollection> RetrieveMultipleAsync(ArxQueryExpression query, ArxRetrieveOptions? options = null, CancellationToken cancellationToken = default)Runs a query: its records, page and, when asked, total.
Parameter Type Description queryArxQueryExpressionThe query: its row source, columns, criteria, links, order, paging and aggregates. optionsArxRetrieveOptions?= nullHow the row is found and read (match, command timeout, lookup names); null for the defaults. cancellationTokenCancellationToken= defaultCancels the call. Task<ArxExecuteResult> ExecuteAsync(ArxProcedureExpression procedure, ArxExecuteOptions? options = null, CancellationToken cancellationToken = default)Calls a procedure or function (ARX8001 where StoredProcedures isn't supported).
Parameter Type Description procedureArxProcedureExpressionThe procedure or function to call, with its arguments. optionsArxExecuteOptions?= nullOptions of the call (paging, command timeout); null for the defaults. cancellationTokenCancellationToken= defaultCancels the call. Task<ArxEntity?> RetrieveAsync(ArxEntity match, ArxRetrieveOptions? options = null, CancellationToken cancellationToken = default)Reads the one record the entity finds: by its id, or by the match of the options (a declared key, columns); the columns of the options (all when null); null when none is there. On DynamoDB this is how an item of a single table (or one with a sort key) is read by its whole key.
Parameter Type Description matchArxEntityThe record to find: its table, and the values of the id, the declared key or the columns that find it. optionsArxRetrieveOptions?= nullHow the row is found and read (match, command timeout, lookup names); null for the defaults. cancellationTokenCancellationToken= defaultCancels the call. Task<int> DeleteMultipleAsync<TId>(string entityName, IReadOnlyCollection<TId> ids, CancellationToken cancellationToken = default)Deletes the records with these ids, all or nothing, and returns how many existed. Duplicates count once. One method for every id type: a list of
long,int,Guid,stringorArxRecordId; another element type is ARX1007 UnsupportedValueType.Parameter Type Description entityNamestringThe table to delete from. idsIReadOnlyCollection<TId>The ids of the records to delete; ids that match nothing are left out of the count. cancellationTokenCancellationToken= defaultCancels the call. Task<ArxRecordId> CreateAsync(ArxEntity entity, ArxTransaction transaction, CancellationToken cancellationToken = default)Creates one record in an ARX transaction (from the provider's connection) and returns its id.
Parameter Type Description entityArxEntityThe record to create: its table and the attributes to write. Its RecordIdis set to the new id.transactionArxTransactionThe ARX transaction to run in (from the provider's connection type). ARX doesn't commit or roll it back. cancellationTokenCancellationToken= defaultCancels the call. Task<IReadOnlyList<ArxRecordId>> CreateMultipleAsync(IReadOnlyList<ArxEntity> entities, ArxTransaction transaction, CancellationToken cancellationToken = default)Creates the records in an ARX transaction and returns their ids in the order of the list.
Parameter Type Description entitiesIReadOnlyList<ArxEntity>The records to create, all or nothing; their ids come back in the same order. transactionArxTransactionThe ARX transaction to run in (from the provider's connection type). ARX doesn't commit or roll it back. cancellationTokenCancellationToken= defaultCancels the call. Task<int> UpdateAsync(ArxEntity entity, ArxTransaction transaction, ArxUpdateOptions? options = null, CancellationToken cancellationToken = default)Updates the records the entity finds, in an ARX transaction, and returns how many (as the overload without a transaction); none is ARX2002.
Parameter Type Description entityArxEntityThe change: its table, the attributes to write (null clears a column; an attribute left out keeps its value), and the id, key or columns that find the row. transactionArxTransactionThe ARX transaction to run in (from the provider's connection type). ARX doesn't commit or roll it back. optionsArxUpdateOptions?= nullHow the rows are found ( Match) and checked; null for the defaults (by id).cancellationTokenCancellationToken= defaultCancels the call. Task<int> UpdateMultipleAsync(IReadOnlyList<ArxEntity> entities, ArxTransaction transaction, ArxUpdateOptions? options = null, CancellationToken cancellationToken = default)Updates every entity's record in an ARX transaction and returns how many; one that finds none is ARX2002.
Parameter Type Description entitiesIReadOnlyList<ArxEntity>The changes, all or nothing: each carries the attributes to write and what finds its row. transactionArxTransactionThe ARX transaction to run in (from the provider's connection type). ARX doesn't commit or roll it back. optionsArxUpdateOptions?= nullHow the rows are found ( Match) and checked; null for the defaults (by id).cancellationTokenCancellationToken= defaultCancels the call. Task<bool> DeleteAsync(string entityName, ArxRecordId id, ArxTransaction transaction, CancellationToken cancellationToken = default)Deletes the record with this id in an ARX transaction: true when it was there.
Parameter Type Description entityNamestringThe table to delete from. idArxRecordIdThe record's id: the value Create returned, or a plain value of the declared id's type. transactionArxTransactionThe ARX transaction to run in (from the provider's connection type). ARX doesn't commit or roll it back. cancellationTokenCancellationToken= defaultCancels the call. Task<int> DeleteAsync(ArxEntity entity, ArxTransaction transaction, ArxDeleteOptions? options = null, CancellationToken cancellationToken = default)Deletes the records the entity finds in an ARX transaction and returns how many.
Parameter Type Description entityArxEntityThe record to delete: its table and the id, key or columns that find it. transactionArxTransactionThe ARX transaction to run in (from the provider's connection type). ARX doesn't commit or roll it back. optionsArxDeleteOptions?= nullHow the rows are found ( Match) and checked; null for the defaults (by id).cancellationTokenCancellationToken= defaultCancels the call. Task<int> DeleteMultipleAsync(IReadOnlyList<ArxEntity> entities, ArxTransaction transaction, ArxDeleteOptions? options = null, CancellationToken cancellationToken = default)Deletes the records the entities find in an ARX transaction and returns how many existed.
Parameter Type Description entitiesIReadOnlyList<ArxEntity>The records to delete, all or nothing, each found by its id or by the match's columns. transactionArxTransactionThe ARX transaction to run in (from the provider's connection type). ARX doesn't commit or roll it back. optionsArxDeleteOptions?= nullHow the rows are found ( Match) and checked; null for the defaults (by id).cancellationTokenCancellationToken= defaultCancels the call. Task<ArxEntity?> RetrieveAsync(string entityName, ArxRecordId id, ArxTransaction transaction, ArxColumnSet? columns = null, CancellationToken cancellationToken = default)Reads the record with this id in an ARX transaction, or null. On SQL and MongoDB the read sees the transaction's own writes; DynamoDB sends a transaction's writes at commit, so a read there doesn't see them yet.
Parameter Type Description entityNamestringThe table or view to read. idArxRecordIdThe record's id: the value Create returned, or a plain value of the declared id's type. transactionArxTransactionThe ARX transaction to run in (from the provider's connection type). ARX doesn't commit or roll it back. columnsArxColumnSet?= nullThe columns to read; null or an empty set reads every column. The declared id is always read. cancellationTokenCancellationToken= defaultCancels the call. Task<ArxEntity?> RetrieveAsync(ArxEntity match, ArxTransaction transaction, ArxRetrieveOptions? options = null, CancellationToken cancellationToken = default)Reads the one record the entity finds (by id, a key or columns) in an ARX transaction, or null.
Parameter Type Description matchArxEntityThe record to find: its table, and the values of the id, the declared key or the columns that find it. transactionArxTransactionThe ARX transaction to run in (from the provider's connection type). ARX doesn't commit or roll it back. optionsArxRetrieveOptions?= nullHow the row is found and read (match, command timeout, lookup names); null for the defaults. cancellationTokenCancellationToken= defaultCancels the call. Task<ArxEntityCollection> RetrieveMultipleAsync(ArxQueryExpression query, ArxTransaction transaction, ArxRetrieveOptions? options = null, CancellationToken cancellationToken = default)Runs the query in an ARX transaction and returns the records it finds.
Parameter Type Description queryArxQueryExpressionThe query: its row source, columns, criteria, links, order, paging and aggregates. transactionArxTransactionThe ARX transaction to run in (from the provider's connection type). ARX doesn't commit or roll it back. optionsArxRetrieveOptions?= nullHow the row is found and read (match, command timeout, lookup names); null for the defaults. cancellationTokenCancellationToken= defaultCancels the call. Task<ArxExecuteResult> ExecuteAsync(ArxProcedureExpression procedure, ArxTransaction transaction, ArxExecuteOptions? options = null, CancellationToken cancellationToken = default)Calls a procedure or function in an ARX transaction (ARX8001 where StoredProcedures isn't declared).
Parameter Type Description procedureArxProcedureExpressionThe procedure or function to call, with its arguments. transactionArxTransactionThe ARX transaction to run in (from the provider's connection type). ARX doesn't commit or roll it back. optionsArxExecuteOptions?= nullOptions of the call (paging, command timeout); null for the defaults. cancellationTokenCancellationToken= defaultCancels the call.
Usage
A line from a verified sample; the full, runnable code is on its page.
Show($"added Fabrikam Robotics through IArxDataService ({data.Capabilities.ProviderName})");Set the service up for production, scenario 1
Used in: