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); }
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}."); }
public AutoUpdateProcessLockedException(AutoUpdateDistributedLock distributedLock) : base(FormatMessage(distributedLock)) { DistributedLock = distributedLock; }