Ejemplo n.º 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));
     }
 }
Ejemplo n.º 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));
     }
 }