Documentation / Integrations

SQL Server integration

Troolio.SqlServer provides SQL Server implementations for atomic event transactions, selected-route evidence, projection queues, orchestration state, effect intents, and recovery. Install with dotnet add package Troolio.SqlServer --version 10.0.8 when SQL Server is the persistence authority for a chosen route.

On this page

Choose the contract

ISqlAtomicConnectionFactory supplies database connections. ISqlAtomicEventCodec controls the persisted event format. ISqlAtomicCommitPolicy decides whether a participant may commit; discoverable policy variants provide additional review. SqlAtomicTransactionEngine implements commit and recovery paths, including contextual and no-op variants. Projection consumers apply committed handoffs through ISqlAtomicProjectionApply.

The package includes disposable schema helpers for tests and reference deployments. They are not a substitute for an application-owned migration, locking, indexing, backup, and retention plan. A serving host must provide connection credentials, trusted route admission, actor authorization, erasure fences, and durable operation evidence. Check the selected route's required capabilities before directing commands to it.

Operating a route

Run migrations before traffic. Review stream families, ancillary writes, transaction isolation, deadlock handling, and exact event serialization. Monitor pending projection work, receipts, and route epoch changes. Retain completion evidence at least as long as commands can be retried. See atomic commit, route authority, and recovery.

Example: Freeze an event for SQL

An application codec turns a domain event into the exact bytes and type identifier that SQL will persist. Register a codec whose format can also read historical events.

public static SqlFrozenEvent FreezeSql(ISqlAtomicEventCodec codec, Metadata headers) =>
    codec.Freeze(new Incremented(headers));