예제 #1
0
 /// <summary>
 /// Creates a lock with name <paramref name="lockName"/>, using the given
 /// <paramref name="connectionString"/> to connect to the database via the strategy
 /// specified by <paramref name="connectionStrategy"/>
 /// </summary>
 public SqlDistributedReaderWriterLock(string lockName, string connectionString, SqlDistributedLockConnectionStrategy connectionStrategy)
     : this(lockName, SqlDistributedLock.CreateInternalLock(lockName, connectionString, connectionStrategy))
 {
     if (string.IsNullOrEmpty(connectionString))
     {
         throw new ArgumentNullException(nameof(connectionString));
     }
 }
예제 #2
0
 /// <summary>
 /// Creates a semaphore with name <paramref name="semaphoreName"/> that can be acquired up to <paramref name="maxCount"/>
 /// times concurrently. Uses the given <paramref name="connectionString"/> to connect to the database via the strategy
 /// specified by <paramref name="connectionStrategy"/>
 /// </summary>
 public SqlDistributedSemaphore(string semaphoreName, int maxCount, string connectionString, SqlDistributedLockConnectionStrategy connectionStrategy)
     : this(semaphoreName, maxCount, name => SqlDistributedLock.CreateInternalLock(name, connectionString, connectionStrategy))
 {
     if (string.IsNullOrEmpty(connectionString))
     {
         throw new ArgumentNullException(nameof(connectionString));
     }
 }
예제 #3
0
 /// <summary>
 /// Given <paramref name="baseLockName"/>, constructs a lock name which is safe for use with <see cref="SqlDistributedReaderWriterLock"/>
 /// </summary>
 public static string GetSafeLockName(string baseLockName) => SqlDistributedLock.GetSafeLockName(baseLockName);
예제 #4
0
 public LockScope(SqlDistributedLock @lock, DbTransaction transaction)
 {
     this.@lock       = @lock;
     this.transaction = transaction;
 }