Gsag.Transactional

Lightweight declarative [Transactional] attribute for C# using only native .NET — DispatchProxy + TransactionScope. No AOP libraries.

Wraps any interface method in a System.Transactions.TransactionScope using DispatchProxy, giving you Spring-style transaction management without PostSharp, Castle DynamicProxy, or any other weaving tool.

CI NuGet .NET License: MIT

Install

dotnet add package Gsag.Transactional.Core

Setup

builder.Services.AddTransactionalServices(typeof(Program).Assembly);
builder.Services.AddTransactionalLogging(); // optional — Debug + Warning via MEL

Mark a method on the concrete class:

public class OrderService : IOrderService
{
    [Transactional]
    public async Task PlaceOrderAsync(Order order)
    {
        // runs inside a TransactionScope — commits on success, rolls back on exception
    }
}

Explore

Installation

NuGet setup, DI registration, and logging configuration.

Getting Started

Your first transactional method, step by step.

Propagation Modes

Required, RequiresNew, and Suppress — when and how to use each.

Transaction Hooks

BeforeCommit, AfterCommit, AfterRollback, AfterCompletion — lifecycle callbacks.

Rollback Rules

Control exactly which exceptions trigger rollback.

Architecture

How DispatchProxy, TransactionScope, and AsyncLocal fit together.