SuperMap.Connector.DataProvider.UpdateField C# (CSharp) Method

UpdateField() public method

更新指定数据集的字段信息。
public UpdateField ( string datasourceName, string datasetName, string fieldName, FieldInfo newFiledInfo ) : bool
datasourceName string
datasetName string
fieldName string
newFiledInfo FieldInfo
return bool
        public bool UpdateField(string datasourceName, string datasetName, string fieldName, FieldInfo newFiledInfo)
        {
#if NET40
            if (string.IsNullOrWhiteSpace(datasourceName))
            {
                throw new ArgumentNullException("datasourceName", Resources.ArgumentIsNotNull);
            }
            if (string.IsNullOrWhiteSpace(datasetName))
            {
                throw new ArgumentNullException("datasetName", Resources.ArgumentIsNotNull);
            }
            if (string.IsNullOrWhiteSpace(fieldName))
            {
                throw new ArgumentNullException("fieldName", Resources.ArgumentIsNotNull);
            }
#else
            if (string.IsNullOrEmpty(datasourceName))
            {
                throw new ArgumentNullException("datasourceName", Resources.ArgumentIsNotNull);
            }
            if (string.IsNullOrEmpty(datasetName))
            {
                throw new ArgumentNullException("datasetName", Resources.ArgumentIsNotNull);
            }
            if (string.IsNullOrEmpty(fieldName))
            {
                throw new ArgumentNullException("fieldName", Resources.ArgumentIsNotNull);
            }
#endif
            if (newFiledInfo == null)
            {
                throw new ArgumentNullException("newFiledInfo", Resources.ArgumentIsNotNull);
            }
            FieldInfo currentFieldInfo = GetFieldInfo(datasourceName, datasetName, fieldName);
            currentFieldInfo.Caption = newFiledInfo.Caption;
            string uri = string.Format("{0}/data/datasources/{1}/datasets/{2}/fields/{3}.json?_method=PUT",
                this._serviceUrl, HttpUtility.UrlEncode(datasourceName), HttpUtility.UrlEncode(datasetName),
                HttpUtility.UrlEncode(fieldName));
            string result = SynchHttpRequest.GetRequestString(uri, JsonConvert.SerializeObject(currentFieldInfo));
            return JsonConvert.DeserializeObject<Succeed>(result).succeed;
        }