When using the library with IOC patterns it's often desirable to inject connection information separately from the type of lock or lock name. A centralized provider API would simplify this:
class SqlDistributedLockProvider
{
// factory methods
SqlDistributedLock CreateLock(string name);
SqlDistributedLock CreateLockWithExactName(string name); // does not use GetSafeName()
SqlDistributedReaderWriterLock CreateReaderWriterLock(string name);
...
// we may also want to offer convenience methods for locking directly
IDisposable TryAcquireExclusiveLock(string name, TimeSpan timeout, CancellationToken cancellationToken);
}
Reactions are currently unavailable
When using the library with IOC patterns it's often desirable to inject connection information separately from the type of lock or lock name. A centralized provider API would simplify this:
class SqlDistributedLockProvider { // factory methods SqlDistributedLock CreateLock(string name); SqlDistributedLock CreateLockWithExactName(string name); // does not use GetSafeName() SqlDistributedReaderWriterLock CreateReaderWriterLock(string name); ... // we may also want to offer convenience methods for locking directly IDisposable TryAcquireExclusiveLock(string name, TimeSpan timeout, CancellationToken cancellationToken); }