System.Data.SqlClient.SqlExceptionExtensions.IsLoginError C# (CSharp) Метод

IsLoginError() публичный статический Метод

Determines whether the specified exception represents a login error.
public static IsLoginError ( this exception ) : bool
exception this The exception.
Результат bool
        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;
        }