You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e29d719
Browse filesBrowse the repository at this point in the historyBrowse files
- add a provider-independent database context executor abstraction
- support borrowed and provider-owned context scopes
- expose active transaction state through IDbContext
- add TryRollback for non-throwing rollback attempts
- remove context creation and table metadata from DalBase
- rename database context execution methods
- update public API documentation
Copy file name to clipboardExpand all lines: README.md
+24-8Lines changed: 24 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,43 @@
1
1
# NuExt.System.Data
2
2
3
-
`NuExt.System.Data` provides high-level data access utilities for .NET, including extensions for `DataReader`, `DataRow`, and `DataTable`, lightweight DAL infrastructure, database context abstractions, and a provider-independent migration framework.
3
+
`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.
-**ADO.NET Extensions**: Provides helpers for reading, converting, and manipulating data through `DataReader`, `DataRow`, and `DataTable`.
14
14
-**DAL Infrastructure**: Includes lightweight base classes and database context abstractions for implementing data access layers.
15
15
-**Database Migrations**: Provides provider-independent migration orchestration with ordered execution, validated migration history, optional version metadata, cancellation support, and provider-specific execution contexts.
16
16
17
-
### Commonly Used Types
17
+
##DAL Context Ownership
18
18
19
-
-**`System.Data.DalBase<TDbContext>`**: Base class for Data Access Layer (DAL) implementations.
19
+
The DAL infrastructure supports two execution models:
20
+
21
+
-**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.
22
+
-**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.
23
+
24
+
This allows individual DAL operations to run independently while also supporting coordinated operations across multiple DAL components within the same transaction.
25
+
26
+
## Commonly Used Types
27
+
28
+
-**`System.Data.DalBase<TDbContext>`**: Base class for DAL implementations that supports borrowed contexts and provider-managed owned context scopes.
20
29
-**`System.Data.DataReaderExtensions`**: Provides extension methods for data reader operations.
21
30
-**`System.Data.DataRowExtensions`**: Provides extension methods for data row operations.
22
31
-**`System.Data.DataTableExtensions`**: Provides extension methods for data table operations.
23
32
-**`System.Data.DbMigration<TContext>`**: Base class for defining ordered database schema and data migrations.
24
33
-**`System.Data.DbMigrationContext`**: Base class for provider-specific migration execution contexts.
25
-
-**`System.Data.DbMigrator<TContext>`**: Validates migration configuration and history, and applies pending migrations.
26
-
-**`System.Data.IDbMigrationExecutor<TContext>`**: Defines provider-specific migration execution and
34
+
-**`System.Data.DbMigrator<TContext>`**: Validates migration configuration and applied history, and executes pending migrations.
35
+
-**`System.Data.IDbContext`**: Defines transaction state and lifecycle operations for database contexts.
36
+
-**`System.Data.IDbContextExecutor<TDbContext>`**: Defines provider-specific ownership and execution of database context scopes.
37
+
-**`System.Data.IDbMigrationExecutor<TContext>`**: Defines provider-specific migration execution and transaction handling.
38
+
-**`System.Data.IDbMigrationHistory<TContext>`**: Defines storage operations for applied migration history.
27
39
28
-
###Installation
40
+
## Installation
29
41
30
42
Via [NuGet](https://www.nuget.org/):
31
43
@@ -39,7 +51,11 @@ Or via Visual Studio:
39
51
2. Search for `NuExt.System.Data`.
40
52
3. Click "Install".
41
53
42
-
### Usage Examples
54
+
### Compatibility
55
+
56
+
**.NET Standard 2.0+, .NET 8/9/10 and .NET Framework 4.6.2+**
57
+
58
+
## Usage Examples
43
59
44
60
For a complete provider implementation and migration example, see:
/// Asynchronously executes a function within a database context, ensuring that the context is managed (created, committed, or rolled back) accordingly.
49
+
/// Executes the specified asynchronous action using an existing database context or an owned context created by the executor.
/// Executes a function within a database context and returns a result, ensuring that the context is managed (created, committed, or rolled back) accordingly.
66
+
/// Executes the specified function using an existing database context or an owned context created by the executor.
138
67
/// </summary>
139
-
/// <typeparam name="T">The type of the result produced by the function.</typeparam>
/// Asynchronously executes a function within a database context and returns a result, ensuring that the context is managed (created, committed, or rolled back) accordingly.
84
+
/// Executes the specified asynchronous function using an existing database context or an owned context created by the executor.
181
85
/// </summary>
182
-
/// <typeparam name="T">The type of the result produced by the function.</typeparam>
0 commit comments