示例#1
0
        private AutoUpdateDistributedLock MapDistributedLock(SqlDataReader reader)
        {
            var result = new AutoUpdateDistributedLock();

            if (reader[nameof(result.DistributedLockId)] == null)
            {
                return(null);
            }

            result.DistributedLockId = (string)reader[nameof(result.DistributedLockId)];
            result.LockingId         = (Guid)reader[nameof(result.LockingId)];
            result.LockDate          = (DateTime)reader[nameof(result.LockDate)];
            result.ExpiryDate        = (DateTime)reader[nameof(result.ExpiryDate)];

            return(result);
        }
示例#2
0
 private static string FormatMessage(AutoUpdateDistributedLock distributedLock)
 {
     return($"The auto-update process cannot be started because it has been locked by another " +
            $"machine on {distributedLock.LockDate}. The lock is due to expire on {distributedLock.ExpiryDate}.");
 }
示例#3
0
 public AutoUpdateProcessLockedException(AutoUpdateDistributedLock distributedLock)
     : base(FormatMessage(distributedLock))
 {
     DistributedLock = distributedLock;
 }