Skip to content

About

Lightweight ADO.NET utilities, DAL infrastructure, database contexts, and provider-independent migration orchestration for .NET.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

NuExt.System.Data

NuExt.System.Data provides a lightweight and extensible foundation for data access in .NET applications. It combines practical ADO.NET extensions, reusable DAL and database context abstractions, explicit transaction management, and provider-independent database migrations with validated history tracking.

NuGet Ask DeepWiki Build License Downloads

Features

  • ADO.NET Extensions: Provides helpers for reading, converting, and manipulating data through DataReader, DataRow, and DataTable.
  • DAL Infrastructure: Includes lightweight base classes and database context abstractions for implementing data access layers.
  • Database Migrations: Provides provider-independent orchestration with ordered execution, sequence-aware history validation, optional version metadata, cancellation support, and provider-specific execution contexts.

DAL Context Ownership

The DAL infrastructure supports two execution models:

  • Owned context: When no database context is provided, the provider-specific executor creates and owns the context. It manages the connection, transaction, commit or rollback, and resource cleanup.
  • Borrowed context: When an existing database context is provided, the DAL participates in the caller's unit of work without committing, rolling back, or disposing the context.

This allows individual DAL operations to run independently while also supporting coordinated operations across multiple DAL components within the same transaction.

Database Migration Model

The migration framework is designed for application-integrated, forward-only database evolution. Migrations are registered explicitly in the order in which they must be applied, making the target schema deterministic and avoiding reflection-based discovery.

Each applied migration is recorded with its one-based position in the configured migration sequence, stable identifier, application time, and optional version information. Before applying pending migrations, the framework validates that the stored history is an exact prefix of the configured sequence, including both sequence positions and migration identifiers. This detects removed, renamed, reordered, unknown, or incorrectly positioned migrations before any schema changes are made.

Transaction ownership is explicit and provider-controlled. A provider can execute the complete migration batch within its own transaction or participate in an existing database context, allowing migrations and application operations to share the same transaction.

Migration history storage is provider-defined. Providers may maintain a single history or isolate multiple independently validated migration sequences while reusing the same orchestration model.

Commonly Used Types

  • DalBase<TDbContext>: Base class for DAL implementations that supports borrowed contexts and provider-managed owned context scopes.
  • DataReaderExtensions: Provides extension methods for data reader operations.
  • DataRowExtensions: Provides extension methods for data row operations.
  • DataTableExtensions: Provides extension methods for data table operations.
  • IDbContext: Defines transaction state and lifecycle operations for database contexts.
  • IDbContextExecutor<TDbContext>: Defines provider-specific ownership and execution of database context scopes.
  • AppliedDbMigration: Represents an applied migration together with its sequence position, identifier, application time, and optional version information.
  • DbMigration<TContext>: Base class for defining ordered database schema and data migrations.
  • DbMigrationContext: Base class for provider-specific migration execution contexts.
  • DbMigrator<TContext>: Validates migration configuration and applied history, and executes pending migrations.
  • IDbMigrationExecutor<TContext>: Defines provider-specific migration execution and transaction handling.
  • IDbMigrationHistory<TContext>: Defines provider-specific storage operations for applied migration history.

Installation

Via NuGet:

dotnet add package NuExt.System.Data

Or via Visual Studio:

  1. Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution....
  2. Search for NuExt.System.Data.
  3. Click "Install".

Compatibility

.NET Standard 2.0+, .NET 8/9/10 and .NET Framework 4.6.2+

Usage Examples

For a complete provider implementation and migration example, see:

Ecosystem

Contributing

Issues and PRs are welcome. Keep changes minimal and performance-conscious.

License

MIT. See LICENSE.

About

Lightweight ADO.NET utilities, DAL infrastructure, database contexts, and provider-independent migration orchestration for .NET.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Used by

Contributors

Languages