private SqlDistributedLock(string lockName, IInternalSqlDistributedLock internalLock) { if (lockName == null) { throw new ArgumentNullException("lockName"); } if (lockName.Length > MaxLockNameLength) { throw new FormatException("lockName: must be at most " + MaxLockNameLength + " characters"); } this.internalLock = internalLock; }
private SqlDistributedSemaphore(string semaphoreName, int maxCount, Func <string, IInternalSqlDistributedLock> createInternalLockFromName) { if (semaphoreName == null) { throw new ArgumentNullException("lockName"); } if (maxCount < 1) { throw new ArgumentOutOfRangeException(nameof(maxCount), maxCount, "must be positive"); } this.strategy = new SqlSemaphore(maxCount); this.internalLock = createInternalLockFromName(SqlSemaphore.ToSafeName(semaphoreName)); }
public OptimisticConnectionMultiplexingSqlDistributedLock(string lockName, string connectionString) { this.lockName = lockName; this.connectionString = connectionString; this.fallbackLock = new OwnedConnectionSqlDistributedLock(lockName: lockName, connectionString: connectionString); }