Interface IDataProvider

Assembly: redb.Export.dll

Abstracts database-specific operations required by the export/import pipeline.

Each implementation handles connection management, bulk-insert strategy,
constraint toggling, and sequence manipulation for its target RDBMS.

public interface IDataProvider : IAsyncDisposable

Properties

Connection

Returns the underlying instance.

DbConnection Connection { get; }

Name

Short provider identifier (e.g. "postgres", "mssql").

string Name { get; }

Methods

AbortImportAsync()

Rolls back whatever the import wrote and restores the session state it changed. Called on every path

Task AbortImportAsync()

BeginImportAsync(CancellationToken)

Starts the import transaction. Everything the import writes from here on - cleaning, rows, the

Task BeginImportAsync(CancellationToken ct = default)

BulkInsertAsync(string, DataTable, CancellationToken)

Performs a bulk insert of the supplied

Task BulkInsertAsync(string tableName, DataTable data, CancellationToken ct = default)

CleanDatabaseAsync(CancellationToken)

Truncates all REDB tables in the correct foreign-key order, leaving the schema intact.

Task CleanDatabaseAsync(CancellationToken ct = default)

CommitImportAsync(CancellationToken)

Commits the import transaction and restores the session state the import changed.

Task CommitImportAsync(CancellationToken ct = default)

DisableConstraintsAsync(CancellationToken)

Disables foreign-key constraints and triggers so that rows can be

Task DisableConstraintsAsync(CancellationToken ct = default)

EnableConstraintsAsync(CancellationToken)

Re-enables foreign-key constraints and triggers after bulk import.

Task EnableConstraintsAsync(CancellationToken ct = default)

ExecuteAsync(string, CancellationToken)

Executes a statement that returns no rows (DDL included). Inside an import it runs in the

Task ExecuteAsync(string sql, CancellationToken ct = default)

GetSequenceValueAsync(CancellationToken)

Returns the current value of the global_identity sequence.

Task<long> GetSequenceValueAsync(CancellationToken ct = default)

GuidFromDb(object)

Reads a uuid-semantic column value into its portable form.

Guid GuidFromDb(object raw)

GuidToDb(Guid)

Converts a portable into the value this provider stores in a

object GuidToDb(Guid value)

OpenAsync(string, CancellationToken)

Opens a connection to the database using the supplied connection string.

Task OpenAsync(string connectionString, CancellationToken ct = default)

ReadDateTimeOffset(DbDataReader, int)

Reads a date column of a redb table into its portable form.

DateTimeOffset ReadDateTimeOffset(DbDataReader reader, int ordinal)

SetSequenceValueAsync(long, CancellationToken)

Resets the global_identity sequence to the specified value

Task SetSequenceValueAsync(long value, CancellationToken ct = default)