Sage.SData.Client.Core.SDataService.Read C# (CSharp) Method

Read() public method

generic read from the specified url
public Read ( string url ) : object
url string url to read from
return object
        public virtual object Read(string url)
        {
            Guard.ArgumentNotNull(url, "url");

            try
            {
                var operation = new RequestOperation(HttpMethod.Get);
                var response = ExecuteRequest(url, operation);

                if (response.Content is string && response.ContentType == MediaType.Xml)
                {
                    try
                    {
                        return ReadSchema(response);
                    }
                    catch (XmlException)
                    {
                    }
                    catch (InvalidOperationException)
                    {
                    }
                }

                return response.Content;
            }
            catch (SDataClientException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new SDataClientException(ex.Message, ex);
            }
        }