public static bool IsLoginError(this SqlException exception)
{
Contract.Requires(exception != null);
// 4060 -> Cannot open database "%.*ls" requested by the login. The login failed.
// 4064 -> Cannot open user default database. Login failed.
// 18461 -> Login failed for user '%.*ls'. Reason: Server is in single user mode. Only one administrator can connect at this time.%.*ls
return exception.Number == 4060 || exception.Number == 18461;
}