Getting Started
Architecture
NServiceBus
Transports
ServiceInsight
ServicePulse
ServiceControl
Monitoring
Samples

Azure Storage Persistence Upgrade Version 4 to 5

Switching to Azure.Data.Tables

This version introduces support for Azure.Data.Tables and moves away from the deprecated Microsoft.Azure.Cosmos.Table package.

For an overview of the SDK changes, refer to the official Azure migration guide.

In brief though, instances of CloudTableClient need to be replaced with TableServiceClient and TableEntity needs to be replaced with ITableEntity when declaring saga entities. Any properties that should be excluded from storage, use the IgnoreDataMember-attribute instead of IgnoreProperty.

Passing an instance of the client

Instead of:

var persistence = endpointConfiguration.UsePersistence<AzureTablePersistence>();
var account = CloudStorageAccount.Parse(connection);
var cloudTableClient = account.CreateCloudTableClient();
persistence.UseCloudTableClient(cloudTableClient);

Use:

var persistence = endpointConfiguration.UsePersistence<AzureTablePersistence>();
var tableServiceClient = new TableServiceClient(connection);
persistence.UseTableServiceClient(tableServiceClient);

Configuring a client provider

Previously, a custom Cloud table client provider could be created by implementing IProvideCloudTableClient which is now replaced with IProvideTableServiceClient to reflect the new client type.

See the configuration section for additional guidance.

Compatibility mode

This package continues to be fully compatible with the NServiceBus.Persistence.AzureStorage version 1 and 2. It supports both sagas that use secondary index entries as well as sagas that don't have a secondary index entries. It's important to note that the compatibility mode does need to be manually enabled. It has been disabled by default in favor of performance.

To opt-in for the compatibility mode, use:

var persistence = endpointConfiguration.UsePersistence<AzureTablePersistence>();
var compatibility = persistence.Compatibility();
compatibility.EnableSecondaryKeyLookupForSagasCorrelatedByProperties();

Related Articles