コード例 #1
0
        public CloudOdsStatus Execute(string instanceName)
        {
            OdsInstance instance = null;

            try
            {
                instance = _usersContext.OdsInstances.SingleOrDefault(i => i.Name == instanceName);
            }
            catch (SqlException s)
            {
                //Login failed likely means we haven't yet completed initial setup
                //so we'll return InstanceNotRegistered below
                if (!s.Message.StartsWith("Login failed"))
                {
                    throw;
                }
            }
            catch (EntityCommandExecutionException s)
            {
                //Similarly check for the corresponding exception from NpgSql
                var inner = s.InnerException as PostgresException;
                if (inner == null || !(inner.Message.Contains("relation") && inner.Message.Contains("does not exist")))
                {
                    throw;
                }
            }


            if (instance == null)
            {
                return(CloudOdsStatus.InstanceNotRegistered);
            }

            return(CloudOdsStatus.Parse(instance.Status));
        }
コード例 #2
0
        public CloudOdsStatus Execute(string instanceName)
        {
            OdsInstance instance = null;

            try
            {
                instance = _usersContext.OdsInstances.SingleOrDefault(i => i.Name == instanceName);
            }
            catch (SqlException s)
            {
                //Login failed likely means we haven't yet completed initial setup
                //so we'll return InstanceNotRegistered below
                if (!s.Message.StartsWith("Login failed"))
                {
                    throw;
                }
            }


            if (instance == null)
            {
                return(CloudOdsStatus.InstanceNotRegistered);
            }

            return(CloudOdsStatus.Parse(instance.Status));
        }