I have some code that is using the Obsolete version of UseSqlServerInLeaseMode when adding a Rebus service to my app.
The obsolete version (below) has several parameters, all (but the last) of which are in use in my code.
<code>public static void UseSqlServerInLeaseMode(
this StandardConfigurer<ITransport> configurer,
string connectionString,
string inputQueueName,
TimeSpan? leaseInterval = null,
TimeSpan? leaseTolerance = null,
bool automaticallyRenewLeases = false,
TimeSpan? leaseAutoRenewInterval = null,
Func<string> leasedByFactory = null,
bool enlistInAmbientTransaction = false,
bool ensureTablesAreCreated = true
)
</code>
<code>public static void UseSqlServerInLeaseMode(
this StandardConfigurer<ITransport> configurer,
string connectionString,
string inputQueueName,
TimeSpan? leaseInterval = null,
TimeSpan? leaseTolerance = null,
bool automaticallyRenewLeases = false,
TimeSpan? leaseAutoRenewInterval = null,
Func<string> leasedByFactory = null,
bool enlistInAmbientTransaction = false,
bool ensureTablesAreCreated = true
)
</code>
public static void UseSqlServerInLeaseMode(
this StandardConfigurer<ITransport> configurer,
string connectionString,
string inputQueueName,
TimeSpan? leaseInterval = null,
TimeSpan? leaseTolerance = null,
bool automaticallyRenewLeases = false,
TimeSpan? leaseAutoRenewInterval = null,
Func<string> leasedByFactory = null,
bool enlistInAmbientTransaction = false,
bool ensureTablesAreCreated = true
)
The recommended version I should be using is:
<code>public static SqlServerLeaseTransportOptions UseSqlServerInLeaseMode(
this StandardConfigurer<ITransport> configurer,
SqlServerLeaseTransportOptions transportOptions,
string inputQueueName
)
</code>
<code>public static SqlServerLeaseTransportOptions UseSqlServerInLeaseMode(
this StandardConfigurer<ITransport> configurer,
SqlServerLeaseTransportOptions transportOptions,
string inputQueueName
)
</code>
public static SqlServerLeaseTransportOptions UseSqlServerInLeaseMode(
this StandardConfigurer<ITransport> configurer,
SqlServerLeaseTransportOptions transportOptions,
string inputQueueName
)
I’m really not clear how I should use this new version, most of the parameters in the new classes seem to be readonly and every variation I have tried so far will not compile.
Does someone have a code snippet showing how I remove this obsolete code?
Many thanks!