Persilsoft.Transactions
1.0.8
dotnet add package Persilsoft.Transactions --version 1.0.8
NuGet\Install-Package Persilsoft.Transactions -Version 1.0.8
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Persilsoft.Transactions" Version="1.0.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Persilsoft.Transactions" Version="1.0.8" />
<PackageReference Include="Persilsoft.Transactions" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Persilsoft.Transactions --version 1.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Persilsoft.Transactions, 1.0.8"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Persilsoft.Transactions&version=1.0.8
#tool nuget:?package=Persilsoft.Transactions&version=1.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Persilsoft.Transactions
Provides a service for transaccion management.
Example
First, you need to register the required service.
using Persilsoft.Transactions;
builder.Services.AddTransactionScopeServices();
// builder.Services.AddTransactionEFService<MyDbContext>(); -- For SQLite provider
Finally, you can use the service.
using Persilsoft.Transactions.Abstractions;
app.MapPost("/person/register", async (MyDbContext context, ITransactionService transactionService) =>
{
try
{
transactionService.BeginTransaction();
context.Persons.Add(new Person
{
FirstName = "Juan",
LastName = "Pérez"
});
await context.SaveChangesAsync();
var otherOperationIsSuccess = await Task.FromResult(false);
if (!otherOperationIsSuccess)
{
throw new Exception("An error has ocurred.");
}
transactionService.CommitTransaction();
return Results.Ok("Operation Success");
}
catch (Exception ex)
{
transactionService.RollbackTransaction();
return Results.Problem(detail: ex.Message);
}
})
.WithTags("Person");
Note:
You can use constructor injection.
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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.EntityFrameworkCore (>= 8.0.15)
- Persilsoft.Transactions.Abstractions (= 1.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Persilsoft.Transactions:
Package | Downloads |
---|---|
Persilsoft.Membership.AspNetIdentity.SqlServer
Contains the configuration and DbContext for AspNetIdentity projects with Sql Server provider |
|
Persilsoft.Membership.AspNetIdentity.SQLite
Contains the configuration and DbContext for AspNetIdentity projects with SQLite provider |
GitHub repositories
This package is not used by any popular GitHub repositories.