SQL Persistence Upgrade Version 2 to 3

Component: Sql Persistence
This page targets a pre-release version and is subject to change prior to the final release.

Accessing business data

When accessing business data in Versions 2 and below the SQL persistence session information was injected into the storage session state irrespective of the selected storage type. In Versions 3 and above the SQL persistence session information will only be injected if the SQL persistence is used for either Sagas or the Outbox. If the SQL persistence is for one of those and another persistence is used for the other than an exception will be thrown. So for example it is not possible to mix the SQL persistence for Sagas with there any other persistence for Outbox. The same applies for the inverse.

Variant renamed to Dialect

To more accurately reflect SQL vernacular "Variant" has been renamed to "Dialect".

3-pre NServiceBus.Persistence.Sql
var persistence = endpointConfiguration.UsePersistence<SqlPersistence>();
persistence.SqlDialect<SqlDialect.MySql>();
2.x NServiceBus.Persistence.Sql
var persistence = endpointConfiguration.UsePersistence<SqlPersistence>();
persistence.SqlVariant(SqlVariant.MySql);

The SqlDialect method also returns a typed settings instance that can be used to apply configuration specific to that dialect.

3-pre NServiceBus.Persistence.Sql
var persistence = endpointConfiguration.UsePersistence<SqlPersistence>();
var mySqlDialectSettings = persistence.SqlDialect<SqlDialect.MySql>();

Schema moved to SqlDialect

Schema configuration has been moved to extend the result of the SqlDialect method.

3-pre NServiceBus.Persistence.Sql
var persistence = endpointConfiguration.UsePersistence<SqlPersistence>();
var dialect = persistence.SqlDialect<SqlDialect.MsSqlServer>();
dialect.Schema("MySchema");
2.x NServiceBus.Persistence.Sql
var persistence = endpointConfiguration.UsePersistence<SqlPersistence>();
persistence.Schema("MySchema");

Last modified