private static string MakeMessage(Accessor.LockType held, Accessor.LockType desired, Accessor.LockType required) { if (required == Accessor.LockType.None) { return("Attempted to acquire a " + desired + " database lock when a " + held + " lock was held, but no lock must be held."); } else { return("Attempted to acquire a " + desired + " database lock when a " + held + " lock was held, but a " + required + " lock must be held instead."); } }
private static string MakeMessage(Accessor.LockType held, Accessor.LockType minimum) { if (held == Accessor.LockType.None) { throw new Exception("Attempted a database operation which requires at least a " + minimum + " lock when no lock was held."); } else { throw new Exception("Attempted a database operation which requires at least a " + minimum + " lock when only a " + held + "lock was held."); } }
public LockMinimumNotMet(Accessor.LockType held, Accessor.LockType minimum) : base(MakeMessage(held, minimum)) { }
public BadLockChange(Accessor.LockType held, Accessor.LockType desired, Accessor.LockType required) : base(MakeMessage(held, desired, required)) { }