Skip to main content

API Reference

This page lists all public types and their key members across all AdoNet.Async packages.

AdoNet.Async

Core interfaces and abstract base classes. Zero dependencies.

dotnet add package AdoNet.Async

Interfaces

TypeDescription
IAsyncDbConnectionAsync connection interface. Extends IAsyncDisposable, IDisposable.
IAsyncDbCommandAsync command interface. Extends IAsyncDisposable, IDisposable.
IAsyncDbTransactionAsync transaction interface. Extends IAsyncDisposable, IDisposable.
IAsyncDataReaderAsync data reader. Extends IAsyncDataRecord, IAsyncEnumerable<IAsyncDataRecord>, IAsyncDisposable, IDisposable.
IAsyncDataRecordSync field accessors plus IsDBNullAsync and GetFieldValueAsync<T>.
IAsyncDbProviderFactoryFactory for creating connections, commands, and parameters.

IAsyncDbConnection

MemberReturnsDescription
ConnectionStringstringGet/set the connection string
ConnectionTimeoutintConnection timeout in seconds
DatabasestringCurrent database name
StateConnectionStateCurrent connection state
OpenAsync(ct)ValueTaskOpen the connection
CloseAsync()ValueTaskClose the connection
BeginTransactionAsync(ct)ValueTask<IAsyncDbTransaction>Begin a transaction
BeginTransactionAsync(il, ct)ValueTask<IAsyncDbTransaction>Begin a transaction with isolation level
ChangeDatabaseAsync(name, ct)ValueTaskChange the current database
CreateCommand()IAsyncDbCommandCreate a new command
Open()voidSync open
Close()voidSync close
BeginTransaction()IAsyncDbTransactionSync begin transaction
ChangeDatabase(name)voidSync change database

IAsyncDbCommand

MemberReturnsDescription
CommandTextstringGet/set the SQL text
CommandTimeoutintGet/set the timeout
CommandTypeCommandTypeGet/set the command type
ConnectionIAsyncDbConnection?Get/set the connection
TransactionIAsyncDbTransaction?Get/set the transaction
ParametersIDataParameterCollectionParameter collection
UpdatedRowSourceUpdateRowSourceGet/set update row source
ExecuteReaderAsync(ct)ValueTask<IAsyncDataReader>Execute and return a reader
ExecuteReaderAsync(behavior, ct)ValueTask<IAsyncDataReader>Execute with command behavior
ExecuteNonQueryAsync(ct)ValueTask<int>Execute and return rows affected
ExecuteScalarAsync(ct)ValueTask<object?>Execute and return first column of first row
PrepareAsync(ct)ValueTaskPrepare the command
CreateParameter()IDbDataParameterCreate a parameter
Cancel()voidCancel execution

IAsyncDbTransaction

MemberReturnsDescription
ConnectionIAsyncDbConnectionThe owning connection
IsolationLevelIsolationLevelTransaction isolation level
CommitAsync(ct)ValueTaskCommit the transaction
RollbackAsync(ct)ValueTaskRoll back the transaction
Commit()voidSync commit
Rollback()voidSync rollback

IAsyncDataReader

MemberReturnsDescription
DepthintNesting depth
IsClosedboolWhether the reader is closed
RecordsAffectedintNumber of rows changed/inserted/deleted
HasRowsboolWhether the result set has rows
ReadAsync(ct)ValueTask<bool>Advance to the next row
NextResultAsync(ct)ValueTask<bool>Advance to the next result set
CloseAsync()ValueTaskClose the reader
GetSchemaTableAsync(ct)ValueTask<DataTable>Get the schema table
GetSchemaTable()DataTableSync get schema table

Also implements IAsyncEnumerable<IAsyncDataRecord> for await foreach support.

IAsyncDataRecord

MemberReturnsDescription
FieldCountintNumber of columns
this[int]objectGet value by ordinal
this[string]objectGet value by name
GetBoolean(i) ... GetDateTime(i)variousTyped field accessors
GetName(i)stringColumn name by ordinal
GetOrdinal(name)intOrdinal by column name
GetValue(i)objectValue as object
GetValues(values)intFill array with values
IsDBNull(i)boolCheck for null
IsDBNullAsync(i, ct)ValueTask<bool>Async null check
GetFieldValueAsync<T>(i, ct)ValueTask<T>Async typed field access

IAsyncDbProviderFactory

MemberReturnsDescription
CreateConnection()IAsyncDbConnectionCreate a new connection
CreateCommand()IAsyncDbCommandCreate a new command
CreateParameter()IDbDataParameterCreate a new parameter

Abstract Base Classes

TypeImplementsDescription
AsyncDbConnectionIAsyncDbConnectionBase class with sync-over-async bridge
AsyncDbCommandIAsyncDbCommandBase class with sync-over-async bridge
AsyncDbDataReaderIAsyncDataReaderBase class with IAsyncEnumerable iterator
AsyncDbTransactionIAsyncDbTransactionBase class with sync-over-async bridge

AdoNet.Async.DataSet

Async DataTable, DataSet, DataRow, and DataAdapter. Depends on ZeroAlloc.AsyncEvents.

dotnet add package AdoNet.Async.DataSet
TypeDescription
AsyncDataTableAsync wrapper around DataTable. Exposes 9 async events.
AsyncDataTable<TRow>Generic base for typed DataTable with typed row collection.
AsyncDataSetAsync wrapper around DataSet.
AsyncDataRowAsync row with read-only indexers and SetValueAsync/DeleteAsync.
AsyncDataRowCollectionAsync row collection with AddAsync, RemoveAsync.
AsyncDataRowCollection<TRow>Generic typed row collection.
AsyncDataTableCollectionCollection of AsyncDataTable within an AsyncDataSet.
AsyncDataAdapterAbstract base for async data adapters with FillAsync/UpdateAsync.

AsyncDataTable -- Key Members

MemberReturnsDescription
TableNamestringGet/set table name
ColumnsDataColumnCollectionColumn definitions
RowsAsyncDataRowCollectionRow collection
ConstraintsConstraintCollectionTable constraints
PrimaryKeyDataColumn[]Get/set primary key columns
DataSetAsyncDataSet?Parent DataSet
NewRow()AsyncDataRowCreate a new row
LoadAsync(reader, ct)ValueTask<int>Load from IAsyncDataReader
LoadAsync(reader, loadOption, ct)ValueTask<int>Load with load option
AcceptChangesAsync(ct)ValueTaskAccept all changes
ClearAsync(ct)ValueTaskClear all rows
Clone()AsyncDataTableClone schema only
Copy()AsyncDataTableClone schema and data
GetChanges()AsyncDataTable?Get changed rows
Select(filter, sort)AsyncDataRow[]Filter and sort rows

Async events: ColumnChangingAsync, ColumnChangedAsync, RowChangingAsync, RowChangedAsync, RowDeletingAsync, RowDeletedAsync, TableClearingAsync, TableClearedAsync, TableNewRowAsync.

AsyncDataRow -- Key Members

MemberReturnsDescription
this[string]objectRead value by column name
this[int]objectRead value by ordinal
this[column, version]objectRead value for a specific version
RowStateDataRowStateCurrent row state
HasErrorsboolWhether the row has errors
TableAsyncDataTableParent table
SetValueAsync(columnName, value, ct)ValueTaskSet column value (fires events)
SetValueAsync(columnIndex, value, ct)ValueTaskSet column value by index
DeleteAsync(ct)ValueTaskMark row as deleted
BeginEditAsync(ct)ValueTaskBegin edit mode
EndEditAsync(ct)ValueTaskEnd edit mode (fires events)
CancelEditAsync(ct)ValueTaskCancel edit mode
AcceptChangesAsync(ct)ValueTaskAccept row changes
RejectChangesAsync(ct)ValueTaskReject row changes

AsyncDataRowCollection -- Key Members

MemberReturnsDescription
CountintNumber of rows
this[int]AsyncDataRowRow by index
AddAsync(row, ct)ValueTaskAdd a row (fires events)
AddAsync(values, ct)ValueTaskAdd row from value array
RemoveAsync(row, ct)ValueTaskRemove a row (fires events)
RemoveAtAsync(index, ct)ValueTaskRemove row by index

AsyncDataAdapter -- Key Members

MemberReturnsDescription
SelectCommandIAsyncDbCommand?Select command
InsertCommandIAsyncDbCommand?Insert command
UpdateCommandIAsyncDbCommand?Update command
DeleteCommandIAsyncDbCommand?Delete command
AcceptChangesDuringFillboolAccept changes after fill (default: true)
AcceptChangesDuringUpdateboolAccept changes after update (default: true)
FillAsync(table, ct)ValueTask<int>Fill an AsyncDataTable
FillAsync(dataSet, ct)ValueTask<int>Fill an AsyncDataSet
UpdateAsync(table, ct)ValueTask<int>Send changes to database
UpdateAsync(dataSet, ct)ValueTask<int>Send changes for all tables

AdoNet.Async.Adapters

Adapter wrappers and DI extensions. Depends on Microsoft.Extensions.DependencyInjection.Abstractions.

dotnet add package AdoNet.Async.Adapters
TypeDescription
AdapterDbConnectionWraps DbConnection as IAsyncDbConnection.
AdapterDbCommandWraps DbCommand as IAsyncDbCommand.
AdapterDbDataReaderWraps DbDataReader as IAsyncDataReader.
AdapterDbTransactionWraps DbTransaction as IAsyncDbTransaction.
AdapterDbProviderFactoryWraps DbProviderFactory as IAsyncDbProviderFactory.
AdapterDbDataAdapterConcrete AsyncDataAdapter using adapter commands.
DbConnectionExtensionsExtension method AsAsync() on DbConnection.
ServiceCollectionExtensionsExtension method AddAsyncData() on IServiceCollection.

DbConnectionExtensions

MethodReturnsDescription
AsAsync(this DbConnection)IAsyncDbConnectionWrap any DbConnection

ServiceCollectionExtensions

MethodReturnsDescription
AddAsyncData(services, DbProviderFactory)IServiceCollectionRegister from DbProviderFactory
AddAsyncData(services, IAsyncDbProviderFactory)IServiceCollectionRegister custom factory

Explicit Casts

All adapter types support explicit casts back to the inner type:

DbConnection inner = (DbConnection)(AdapterDbConnection)asyncConnection;
DbCommand inner = (DbCommand)(AdapterDbCommand)asyncCommand;
DbDataReader inner = (DbDataReader)(AdapterDbDataReader)asyncReader;
DbTransaction inner = (DbTransaction)(AdapterDbTransaction)asyncTransaction;

AdoNet.Async.Serialization.NewtonsoftJson

Newtonsoft.Json converters. Wire-compatible with Json.Net.DataSetConverters.

dotnet add package AdoNet.Async.Serialization.NewtonsoftJson
TypeDescription
AsyncDataTableConverterJsonConverter<AsyncDataTable> for Newtonsoft.Json
AsyncDataSetConverterJsonConverter<AsyncDataSet> for Newtonsoft.Json

Namespace: System.Data.Async.Converters


AdoNet.Async.Serialization.SystemTextJson

System.Text.Json converters. Same wire format as Newtonsoft.Json converters.

dotnet add package AdoNet.Async.Serialization.SystemTextJson
TypeDescription
AsyncDataTableJsonConverterJsonConverter<AsyncDataTable> for System.Text.Json
AsyncDataSetJsonConverterJsonConverter<AsyncDataSet> for System.Text.Json

Namespace: System.Data.Async.Converters.SystemTextJson


AdoNet.Async.DataSet.Generator

Roslyn source generator that produces typed async DataSet classes from .xsd schema files.

dotnet add package AdoNet.Async.DataSet.Generator

This is a compile-time-only package. It does not ship any runtime types. Instead, it generates:

Generated TypeBase ClassDescription
Async{DataSetName}AsyncDataSetTyped DataSet with typed table properties
Async{TableName}DataTableAsyncDataTable<TRow>Typed table with Add{Table}RowAsync, FindBy{PK}
Async{TableName}RowAsyncDataRowTyped row with property accessors, Set{Col}Async, Is{Col}Null, Set{Col}Null
Async{TableName}RowChangeEventArgsEventArgsTyped event args for row changes

Supported XSD Annotations

AnnotationAttributeDescription
msdata:AutoIncrementColumnAuto-increment column
msdata:AutoIncrementSeedColumnAuto-increment seed value
msdata:AutoIncrementStepColumnAuto-increment step
msdata:ReadOnlyColumnRead-only column
msdata:PrimaryKeyConstraintMark as primary key
codegen:typedNameColumnOverride property name
codegen:typedPluralTableOverride collection name
codegen:typedParentRelationParent navigation property name
codegen:typedChildrenRelationChild navigation property name
codegen:nullValueColumnNull behavior: _throw, _null, _empty, or replacement value
msdata:DefaultValueColumnDefault value
msdata:ExpressionColumnComputed expression
msdata:DataTypeColumnOverride the CLR data type