# SqlSaga base class > [!WARNING] > Starting in version 8.3.0, the `SqlSaga` class is deprecated. With the [simplified message correlation syntax](/nservicebus/sagas/message-correlation.md) that does not repeat the `.ToSaga(…)` mapping, the alternate saga base class is no longer necessary. > > When using a standard `Saga` base class, the correlation id is determined by analysis of the `ConfigureHowToFindSaga` method. > > A [transitional correlation id](/persistence/sql/saga.md#correlation-ids-transitional-correlation-id) (a feature exlusive to SQL Persistence) can still be applied using the `[SqlSaga]` attribute applied to a saga class. > > The generated [table name](/persistence/sql/saga.md#table-structure-table-name) can also be set using the `[SqlSaga]` attribute. `SqlSaga` is an alternate saga base class for use with SQL persistence that offers a less verbose mapping API than `NServiceBus.Saga`. New projects should use `NServiceBus.Saga` by default. ## SqlSaga definition A saga can be implemented using the `SqlSaga` base class as follows: ```cs public class OrderSaga : SqlSaga, IAmStartedByMessages { static ILog log = LogManager.GetLogger(); protected override void ConfigureMapping(IMessagePropertyMapper mapper) { mapper.ConfigureMapping(message => message.OrderId); } protected override string CorrelationPropertyName => nameof(SagaData.OrderId); public Task Handle(StartOrder message, IMessageHandlerContext context) { log.Info($"Received StartOrder message {Data.OrderId}."); MarkAsComplete(); return Task.CompletedTask; } public class SagaData : ContainSagaData { public Guid OrderId { get; set; } } } ``` Note that there are differences to how a standard NServiceBus saga is implemented. ## Correlation IDs Instead of inferring the correlation property from multiple calls to `.ToSaga(sagaData => sagaData.CorrelationPropertyName)`, the `SqlSaga` base class identifies the correlation property once as a class-level property. ### Single correlation ID In most cases there will be a single correlation ID per Saga Type. ```cs public class SagaWithCorrelation : SqlSaga, IAmStartedByMessages { protected override void ConfigureMapping(IMessagePropertyMapper mapper) { mapper.ConfigureMapping(message => message.CorrelationProperty); } protected override string CorrelationPropertyName => nameof(SagaData.CorrelationProperty); public Task Handle(StartSagaMessage message, IMessageHandlerContext context) { return Task.CompletedTask; } public class SagaData : ContainSagaData { public Guid CorrelationProperty { get; set; } } } ``` ### Correlation and transitional IDs During the migration from one correlation ID to another correlation ID, there may be two correlation IDs that co-exist. See also the [Transitioning Correlation IDs sample](/samples/sql-persistence/transitioning-correlation-ids/index.md). ```cs public class SagaWithCorrelationAndTransitional : SqlSaga, IAmStartedByMessages { protected override void ConfigureMapping(IMessagePropertyMapper mapper) { mapper.ConfigureMapping(message => message.CorrelationProperty); } protected override string CorrelationPropertyName => nameof(SagaData.CorrelationProperty); protected override string TransitionalCorrelationPropertyName => nameof(SagaData.TransitionalCorrelationProperty); public Task Handle(StartSagaMessage message, IMessageHandlerContext context) { return Task.CompletedTask; } public class SagaData : ContainSagaData { public Guid CorrelationProperty { get; set; } public Guid TransitionalCorrelationProperty { get; set; } } } ``` ### No correlation ID When implementing a [custom saga finder](/nservicebus/sagas/saga-finding.md) it is possible to have a message that does not map to a correlation ID and instead interrogates the JSON-serialized data stored in the database. ```cs public class SagaWithNoMessageMapping : SqlSaga { protected override void ConfigureMapping(IMessagePropertyMapper mapper) { } protected override string CorrelationPropertyName => null; public class SagaData : ContainSagaData { } } ``` ## Table suffix A saga's table suffix, which forms part of the [table name](saga.md#table-structure-table-name) in the database, can also be defined more easily using a property override when using the `SqlSaga` base class: ```cs class MySaga:SqlSaga { protected override string TableSuffix => "TheCustomTableName"; ```