Trax.Effect.Data.Sqlite
1.57.2
Prefix Reserved
dotnet add package Trax.Effect.Data.Sqlite --version 1.57.2
NuGet\Install-Package Trax.Effect.Data.Sqlite -Version 1.57.2
<PackageReference Include="Trax.Effect.Data.Sqlite" Version="1.57.2" />
<PackageVersion Include="Trax.Effect.Data.Sqlite" Version="1.57.2" />
<PackageReference Include="Trax.Effect.Data.Sqlite" />
paket add Trax.Effect.Data.Sqlite --version 1.57.2
#r "nuget: Trax.Effect.Data.Sqlite, 1.57.2"
#:package Trax.Effect.Data.Sqlite@1.57.2
#addin nuget:?package=Trax.Effect.Data.Sqlite&version=1.57.2
#tool nuget:?package=Trax.Effect.Data.Sqlite&version=1.57.2
Trax.Effect
The effect layer for Trax.Core. A Trax.Core Train runs a chain of junctions; a Trax.Effect ServiceTrain does the same inside dependency injection and records every run: a Metadata row with its state, timing, input, output and failure, persisted by whichever data provider you install. Optional provider packages add parameter capture, per-junction logging and progress, cross-process event broadcasting, and a persisted state-machine engine.
Full documentation: traxsharp.net/docs. Start with Getting Started and Effect Providers.
The Trax Stack
Trax is a layered framework split across several repos. You can stop at whatever layer solves your problem. You are here: Trax.Effect.
| Repo | Adds |
|---|---|
| Trax.Core | Pipelines, junctions, railway error propagation |
| Trax.Effect | Execution logging, DI, pluggable storage |
| Trax.Mediator | Decoupled dispatch via TrainBus |
| Trax.Scheduler | Cron schedules, retries, dead-letter queues |
| Trax.Api | GraphQL API for remote access |
| Trax.Dashboard | Blazor monitoring UI |
| Trax.Cli | trax-cli project scaffolding tool |
| Trax.Samples | Sample apps and a dotnet new template |
What This Does
Trax.Core gives you Train<TIn, TOut>: a locomotive that carries cargo through a sequence of stops. That's enough for pure logic, but production services need to know what ran, when it departed, whether it arrived, what it was carrying, and what went wrong if it derailed.
Trax.Effect adds the ServiceTrain<TIn, TOut> base class, a full commercial train service that wraps every journey with:
- Journey logging: a persistent metadata record for each run (state, timing, cargo in, cargo out, derailment details)
- Station services: pluggable effect providers that fire during execution (data persistence, logging, parameter serialization, progress tracking)
- DI integration: stops are resolved from
IServiceProvider, so you get constructor injection out of the box
Installation
dotnet add package Trax.Effect
Trax.Effect is the one package every setup needs. The provider packages below pair with it, and each adds an extension method to the AddEffects builder (the broadcaster transports add theirs to the UseBroadcaster builder). Install a data provider to persist runs:
dotnet add package Trax.Effect.Data.Postgres # UsePostgres(connectionString), production
dotnet add package Trax.Effect.Data.Sqlite # UseSqlite(connectionString), single server
dotnet add package Trax.Effect.Data.InMemory # UseInMemory(), tests and prototyping
Then any of the optional providers:
| Package | Adds | What it does |
|---|---|---|
Trax.Effect.Provider.Parameter |
SaveTrainParameters() |
Serializes each run's input and output into its Metadata row |
Trax.Effect.Provider.Json |
AddJson() |
Logs tracked model state as JSON, for debugging |
Trax.Effect.JunctionProvider.Logging |
AddJunctionLogger(serializeJunctionData) |
Logs each junction's name and duration, optionally its input and output |
Trax.Effect.JunctionProvider.Progress |
AddJunctionProgress() |
Persists the current junction on the run and checks for cancellation before each one (needs a data provider) |
Trax.Effect.Broadcaster.RabbitMQ |
UseRabbitMq(connectionString) inside UseBroadcaster(...) |
Carries train lifecycle events between processes |
Trax.Effect.Broadcaster.SignalR |
UseSignalRHub() inside UseBroadcaster(...), and MapTraxTrainEventHub() |
Pushes train lifecycle events to browser and Blazor clients |
Trax.Effect.StateMachine |
The pure snapshot state-machine engine, no dependencies | |
Trax.Effect.StateMachine.Persistence |
AddStateMachines(assemblies) on the builder AddEffects returns |
Persists state-machine drafts in Postgres, with exactly-once effects |
Trax.Effect.Data.Testing |
Data-layer architecture guards for your own test suite | |
Trax.Effect.StateMachine.Testing |
Replays a differential corpus to prove the C# and TypeScript engines agree |
You rarely install Trax.Effect.Data directly: every data provider depends on it.
Setup
Register station services in your IServiceCollection:
builder.Services.AddTrax(trax =>
trax.AddEffects(effects =>
effects.UsePostgres(connectionString).SaveTrainParameters().AddJunctionLogger(serializeJunctionData: true).AddJunctionProgress()
)
);
For development or tests, swap Postgres for in-memory:
builder.Services.AddTrax(trax =>
trax.AddEffects(effects =>
effects.UseInMemory().AddJson()
)
);
Usage
Inherit from ServiceTrain instead of Train:
public interface ICreateUserTrain : IServiceTrain<CreateUserRequest, User> { }
public class CreateUserTrain : ServiceTrain<CreateUserRequest, User>, ICreateUserTrain
{
protected override Task<Either<Exception, User>> Junctions()
=> Chain<ValidateEmailJunction>()
.Chain<CreateUserInDatabaseJunction>()
.Chain<SendWelcomeEmailJunction>()
.Resolve();
}
The chain syntax is identical to Train. The difference is what happens around it. ServiceTrain automatically opens a journey log when the train departs, updates it when it arrives, persists effect data at each station, and records the derailment details if any stop fails.
Junctions work the same way, with full DI:
public class CreateUserInDatabaseJunction(AppDbContext db) : Junction<CreateUserRequest, User>
{
public override async Task<User> Run(CreateUserRequest input)
{
var user = new User { Email = input.Email, Name = input.Name };
db.Users.Add(user);
await db.SaveChangesAsync();
return user;
}
}
Journey Lifecycle
Every ServiceTrain journey transitions through:
Pending → InProgress → Completed
→ Failed
→ Cancelled
Think of it as: the train is boarding (Pending), in transit (InProgress), and then either arrives (Completed), derails (Failed), or is pulled from service (Cancelled). These states are persisted in the journey log and queryable through the data layer.
Station Services
| Service | Package | What it does |
|---|---|---|
| Postgres | Trax.Effect.Data.Postgres |
Persists journey logs and execution data to PostgreSQL |
| InMemory | Trax.Effect.Data.InMemory |
In-memory store for tests and local dev |
| Json | Trax.Effect.Provider.Json |
Logs state transitions as JSON for debugging |
| Parameter | Trax.Effect.Provider.Parameter |
Serializes train cargo (inputs/outputs) into the journey log |
| Sqlite | Trax.Effect.Data.Sqlite |
Persists journey logs to SQLite, for a single server |
| JunctionLogger | Trax.Effect.JunctionProvider.Logging |
Logs each junction's execution with optional cargo serialization |
| JunctionProgress | Trax.Effect.JunctionProvider.Progress |
Tracks per-junction progress and checks for cancellation signals |
Station services compose, so enable as many as you need:
effects
.UsePostgres(connectionString)
.AddJson()
.SaveTrainParameters()
.AddJunctionLogger(serializeJunctionData: true)
.AddJunctionProgress();
Every method is documented under Configuration.
DI Registration Helpers
Register your trains as scoped services with proper interface mapping:
builder.Services.AddScopedTraxRoute<ICreateUserTrain, CreateUserTrain>();
builder.Services.AddTransientTraxRoute<IProcessOrderTrain, ProcessOrderTrain>();
Or use AddMediator (from Trax.Mediator) to auto-register all trains in an assembly.
Next Layer
When you need decoupled dispatch (callers don't know which train handles a request), move up to Trax.Mediator.
License
MIT
Trademark & Brand Notice
Trax is an open-source .NET framework provided by TraxSharp. This project is an independent community effort and is not affiliated with, sponsored by, or endorsed by the Utah Transit Authority, Trax Retail, or any other entity using the "Trax" name in other industries.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- dbup-core (>= 6.1.1)
- dbup-sqlite (>= 6.0.4)
- Microsoft.EntityFrameworkCore (>= 10.0.12)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.12)
- Microsoft.EntityFrameworkCore.Sqlite (>= 10.0.12)
- Microsoft.Extensions.DependencyInjection (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Logging (>= 10.0.12)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- Npgsql (>= 10.0.3)
- SQLitePCLRaw.bundle_e_sqlite3 (>= 3.0.5)
- Trax.Core (>= 1.7.4)
- Trax.Effect.Data (>= 1.57.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.57.2 | 0 | 9/29/2026 |
| 1.57.1 | 0 | 9/29/2026 |
| 1.57.0 | 244 | 9/28/2026 |
| 1.56.0 | 84 | 9/27/2026 |
| 1.55.0 | 69 | 9/25/2026 |
| 1.54.2 | 147 | 9/24/2026 |
| 1.54.1 | 91 | 9/17/2026 |
| 1.54.0 | 296 | 9/15/2026 |
| 1.53.0 | 86 | 9/15/2026 |
| 1.51.0 | 121 | 8/19/2026 |
| 1.50.0 | 119 | 8/13/2026 |
| 1.49.0 | 111 | 8/13/2026 |
| 1.48.1 | 119 | 8/12/2026 |
| 1.48.0 | 130 | 8/12/2026 |
| 1.47.0 | 244 | 8/12/2026 |
| 1.46.0 | 120 | 8/1/2026 |
| 1.45.0 | 123 | 8/1/2026 |
| 1.44.2 | 120 | 8/1/2026 |
| 1.44.1 | 158 | 7/31/2026 |
| 1.43.0 | 258 | 7/29/2026 |