public DatasourceInfo GetDatasourceInfo(string datasourceName)
{
#if NET40
if (string.IsNullOrWhiteSpace(datasourceName))
{
throw new ArgumentNullException("datasourceName", Resources.ArgumentIsNotNull);
}
#else
if(string.IsNullOrEmpty(datasourceName))
{
throw new ArgumentNullException("datasourceName", Resources.ArgumentIsNotNull);
}
#endif
string uri = string.Format("{0}/data/datasources/{1}.json", this._serviceUrl, HttpUtility.UrlEncode(datasourceName));
string result = SynchHttpRequest.GetRequestString(uri);
Dictionary<string, object> hashResult = JsonConvert.DeserializeObject<Dictionary<string, object>>(result);
if (hashResult != null && hashResult.ContainsKey("datasourceInfo") && hashResult["datasourceInfo"] != null)
{
return JsonConvert.DeserializeObject<DatasourceInfo>(hashResult["datasourceInfo"].ToString());
}
return null;
}