public static bool IsDatabaseAvailabilityError(this SqlException exception) { Contract.Requires(exception != null); // TODO: determine the error numbers that represent the database if offline return exception.Class == 20; }