private Server _Connect(string sqlServer) { Server RetVal = new Server(); if (ParamUserId == "") { RetVal.ConnectionContext.LoginSecure = true; } else { RetVal.ConnectionContext.LoginSecure = false; RetVal.ConnectionContext.Login = ParamUserId; RetVal.ConnectionContext.Password = ParamPassword; } StringBuilder LogText = new StringBuilder($"-- ##### Connecting to the server : {sqlServer} ##### ... :"); try { IsSqlConnectionActive = true; foreach (ServerRole ServerRoleItem in RetVal.Roles) { ServerRoles.Add(ServerRoleItem.Name); } LogText.Append("OK"); return(RetVal); } catch (Exception ex) { IsSqlConnectionActive = false; LogText.Append($"FAILED : {ex.Message}"); return(null); } finally { Log(LogText.ToString()); } }