TransactionContext 0.0.7-preview
dotnet add package TransactionContext --version 0.0.7-preview
NuGet\Install-Package TransactionContext -Version 0.0.7-preview
<PackageReference Include="TransactionContext" Version="0.0.7-preview" />
paket add TransactionContext --version 0.0.7-preview
#r "nuget: TransactionContext, 0.0.7-preview"
// Install TransactionContext as a Cake Addin
#addin nuget:?package=TransactionContext&version=0.0.7-preview&prerelease
// Install TransactionContext as a Cake Tool
#tool nuget:?package=TransactionContext&version=0.0.7-preview&prerelease
TransactionContext (Proof of concept)
TransactionContext is designed to execute statements changing state (also call to stored procedures) in a single transaction and a single request to database (collects SQL statements without instant execution).
It can be an alternative for Entity Framework Core and TransactionScope in .NET.
ITransactionContext
transactionContext.Add("INSERT INTO Customers (CustomerId) VALUES (@CustomerId)", new { CustomerId = Guid.NewGuid() });
transactionContext.Add("INSERT INTO Orders (OrderId) VALUES (@OrderId)", new { OrderId = Guid.NewGuid() });
transactionContext.Commit()
open connection, create transaction and execute sql statments in a single database request.
await transactionContext.Commit();
IDbConnectionFactory
Package also includes a database connection factory.
using var connection = dbConnectionFactory.Create()
Databases
Postgres
Add package
dotnet add package TransactionContext.Postgres
Register dependencies
services.AddTransactionContext(x => x.UsePostgres(connectionString));
Microsoft SQL Server (preview)
Add package
dotnet add package TransactionContext.SqlServer
Register dependencies
services.AddTransactionContext(x => x.UseSqlServer(connectionString));
MySql
Add package
dotnet add package TransactionContext.MySql
Register dependencies
services.AddTransactionContext(x => x.UseMySql(connectionString));
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
NuGet packages (3)
Showing the top 3 NuGet packages that depend on TransactionContext:
Package | Downloads |
---|---|
TransactionContext.Postgres
Package Description |
|
TransactionContext.SqlServer
Package Description |
|
TransactionContext.MySql
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
0.0.7-preview | 59 | 2/9/2024 | |
0.0.6-preview | 46 | 2/8/2024 | |
0.0.5-preview | 47 | 2/7/2024 | |
0.0.4-preview | 48 | 2/5/2024 | |
0.0.3-preview | 44 | 2/5/2024 | |
0.0.2-preview | 43 | 2/5/2024 | |
0.0.1-preview | 44 | 2/5/2024 |