當前位置: 首頁>>代碼示例>>C#>>正文


C# JObject.ExtractValue方法代碼示例

本文整理匯總了C#中Newtonsoft.Json.Linq.JObject.ExtractValue方法的典型用法代碼示例。如果您正苦於以下問題:C# JObject.ExtractValue方法的具體用法?C# JObject.ExtractValue怎麽用?C# JObject.ExtractValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Newtonsoft.Json.Linq.JObject的用法示例。


在下文中一共展示了JObject.ExtractValue方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FromJson

        /// <summary>
        ///     Build SyncTarget from json
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public new static SyncDownTarget FromJson(JObject target)
        {
            if (target == null) return null;

            var query = target.ExtractValue<string>(Constants.Query);
            SoqlSyncDownTarget ssdt = new SoqlSyncDownTarget(query);
            ssdt.setSkipGroupingParenthesis(target.ExtractValue<bool>("skipGroupingParenthesis"));
            return ssdt;
        }
開發者ID:wmigas,項目名稱:SalesforceMobileSDK-Windows,代碼行數:14,代碼來源:SoqlSyncDownTarget.cs

示例2: FromJson

 public static SyncOptions FromJson(JObject options)
 {
     if (options == null)
         return null;
     var mergeModeStr = options.ExtractValue<string>(Constants.MergeMode);
     var mergeMode = String.IsNullOrWhiteSpace(mergeModeStr)
         ? SyncState.MergeModeOptions.None
         : (SyncState.MergeModeOptions) Enum.Parse(typeof (SyncState.MergeModeOptions), mergeModeStr);
     var array = options.ExtractValue<JArray>(Constants.FieldList);
     return array == null ? new SyncOptions(null, mergeMode) : new SyncOptions(array.ToObject<List<string>>(), mergeMode);
 }
開發者ID:maliroteh,項目名稱:SalesforceMobileSDK-Windows,代碼行數:11,代碼來源:SyncOptions.cs

示例3: SalesforceObjectLayoutColumn

 public SalesforceObjectLayoutColumn(JObject rawData)
 {
     if (rawData == null)
     {
         throw new SmartStoreException("rawData parameter cannot be null");
     }
     Name = rawData.ExtractValue<string>(Constants.LayoutNameField);
     Field = rawData.ExtractValue<string>(Constants.LayoutFieldField);
     Format = rawData.ExtractValue<string>(Constants.LayoutFormatField);
     Label = rawData.ExtractValue<string>(Constants.LayoutLabelField);
     RawData = RawData;
 }
開發者ID:maliroteh,項目名稱:SalesforceMobileSDK-Windows,代碼行數:12,代碼來源:SalesforceObjectLayoutColumn.cs

示例4: FromJson

 public static SyncOptions FromJson(JObject options)
 {
     if (options == null)
         return null;
     var mergeModeStr = options.ExtractValue<string>(Constants.MergeMode);
     var mergeMode = String.IsNullOrWhiteSpace(mergeModeStr)
         ? SyncState.MergeModeOptions.None
         : (SyncState.MergeModeOptions) Enum.Parse(typeof (SyncState.MergeModeOptions), mergeModeStr);
     var array = options.ExtractValue<JArray>(Constants.FieldList);
     SyncOptions so = new SyncOptions(array.ToObject<List<string>>(), mergeMode);
     array = options.ExtractValue<JArray>("fieldsToExcludeOnUpdate");
     so.setFieldsToExcludeOnUpdate(array.ToObject<List<string>>());
     return so;
 }
開發者ID:wmigas,項目名稱:SalesforceMobileSDK-Windows,代碼行數:14,代碼來源:SyncOptions.cs

示例5: FromJson

        /// <summary>
        ///     Build SyncTarget from json
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public new static SyncDownTarget FromJson(JObject target)
        {
            if (target == null) return null;

            var query = target.ExtractValue<string>(Constants.Query);
            return new SoqlSyncDownTarget(query);
        }
開發者ID:maliroteh,項目名稱:SalesforceMobileSDK-Windows,代碼行數:12,代碼來源:SoqlSyncDownTarget.cs

示例6: SalesforceObject

 public SalesforceObject(JObject rawData)
 {
     if (rawData == null)
     {
         throw new SmartStoreException("rawData parameter cannot be null");
     }
     var data = rawData.ExtractValue<string>(Constants.Id);
     if (data == null || String.IsNullOrWhiteSpace(data))
     {
         ObjectId = rawData.ExtractValue<string>(Constants.Id.ToLower());
         ObjectType = rawData.ExtractValue<string>(Constants.Type.ToLower());
         Name = rawData.ExtractValue<string>(Constants.Name.ToLower());
     }
     else
     {
         ObjectId = data;
         Name = rawData.ExtractValue<string>(Constants.Name);
         var attributes = rawData.ExtractValue<JObject>(Constants.Attributes);
         if (attributes != null)
         {
             ObjectType = attributes.ExtractValue<string>(Constants.Type.ToLower());
             if (String.IsNullOrWhiteSpace(ObjectType) || Constants.RecentlyViewed.Equals(ObjectType) ||
                 Constants.NullString.Equals(ObjectType))
             {
                 ObjectType = rawData.ExtractValue<string>(Constants.Type);
             }
         }
     }
     RawData = rawData;
     if (ObjectId != null)
     {
         _hashcode = ObjectId.GetHashCode();
     }
     _hashcode ^= rawData.GetHashCode() + _hashcode * 37;
 }
開發者ID:joaoamaral,項目名稱:SalesforceMobileSDK-CordovaPlugin,代碼行數:35,代碼來源:SalesforceObject.cs

示例7: SalesforceObjectType

 public SalesforceObjectType(JObject rawData)
 {
     if (rawData == null)
     {
         throw new SmartStoreException("rawData parameter cannot be null");
     }
     Name = rawData.ExtractValue<string>(Constants.NameField);
     KeyPrefix = rawData.ExtractValue<string>(Constants.KeyprefixField);
     Label = rawData.ExtractValue<string>(Constants.LabelField);
     LabelPlural = rawData.ExtractValue<string>(Constants.LabelpluralField);
     if (String.IsNullOrWhiteSpace(Label))
     {
         Label = Name;
     }
     if (String.IsNullOrWhiteSpace(LabelPlural))
     {
         LabelPlural = Label;
     }
     RawData = RawData;
     IsSearchable = !rawData.ExtractValue<bool>(Constants.HiddenField) &&
                    rawData.ExtractValue<bool>(Constants.SearchableField);
     IsLayoutable = !rawData.ExtractValue<bool>(Constants.HiddenField) &&
                    rawData.ExtractValue<bool>(Constants.LayoutableField);
     Fields = RawData.ExtractValue<JArray>(Constants.FieldsField);
     /*
     * Extracts a few flagship fields and sets them to instance variables
     * for easy retrieval.
     */
     if (Fields == null || Fields.Count <= 0) return;
     for (int i = 0, max = Fields.Count; i < max; i++)
     {
         var field = Fields[i].Value<JObject>();
         var nameFieldPresent = field.ExtractValue<bool>(Constants.NameFieldField);
         if (!nameFieldPresent) continue;
         /*
         * Some objects, such as 'Account', have more than one
         * name field, like 'Name', 'First Name', and 'Last Name'.
         * This check exists to ensure that we use the first
         * name field, which is the flagship name field, and
         * not the last one. If it is already set, we won't
         * overwrite it.
         */
         if (String.IsNullOrWhiteSpace(NameField) || Constants.NullString.Equals(NameField))
         {
             NameField = field.ExtractValue<string>(Constants.NameField);
         }
         else
         {
             // NameField is set, no need to continue.
             break;
         }
     }
 }
開發者ID:maliroteh,項目名稱:SalesforceMobileSDK-Windows,代碼行數:53,代碼來源:SalesforceObjectType.cs

示例8: SyncDownTarget

 protected SyncDownTarget(JObject target)
     : base(target)
 {
     QueryType = (QueryTypes)Enum.Parse(typeof(QueryTypes), target.ExtractValue<string>(Constants.QueryType));
 }
開發者ID:maliroteh,項目名稱:SalesforceMobileSDK-Windows,代碼行數:5,代碼來源:SyncDownTarget.cs

示例9: FromJson

 /// <summary>
 ///     Build SyncState from json
 /// </summary>
 /// <param name="sync"></param>
 /// <returns></returns>
 public static SyncState FromJson(JObject sync)
 {
     if (sync == null) return null;
     var jsonTarget = sync.ExtractValue<JObject>(Constants.SyncTarget);
     var syncType = (SyncTypes)Enum.Parse(typeof(SyncTypes), sync.ExtractValue<string>(Constants.SyncType));
     var state = new SyncState
     {
         Id = sync.ExtractValue<long>(SmartStore.Store.SmartStore.SoupEntryId),
         Target = (syncType == SyncTypes.SyncDown ? (SyncTarget) SyncDownTarget.FromJson(jsonTarget) : SyncUpTarget.FromJSON(jsonTarget)),
         Options = SyncOptions.FromJson(sync.ExtractValue<JObject>(Constants.SyncOptions)),
         SoupName = sync.ExtractValue<string>(Constants.SyncSoupName),
         Progress = sync.ExtractValue<int>(Constants.SyncProgress),
         TotalSize = sync.ExtractValue<int>(Constants.SyncTotalSize),
         SyncType = syncType,
         Status =
             (SyncStatusTypes)
                 Enum.Parse(typeof (SyncStatusTypes), sync.ExtractValue<string>(Constants.SyncStatus)),
         MaxTimeStamp = sync.ExtractValue<long>(Constants.SyncMaxTimeStamp)
     };
     return state;
 }
開發者ID:jhsfdc,項目名稱:SalesforceMobileSDK-Windows,代碼行數:26,代碼來源:SyncState.cs

示例10: SoqlSyncDownTarget

 public SoqlSyncDownTarget(JObject target) : base(target)
 {
     this.Query = target.ExtractValue<string>(QueryString);
 }
開發者ID:maliroteh,項目名稱:SalesforceMobileSDK-Windows,代碼行數:4,代碼來源:SoqlSyncDownTarget.cs

示例11: MruSyncDownTarget

 public MruSyncDownTarget(JObject target) : base(target)
 {
     FieldList = target.ExtractValue<JArray>(Constants.FieldList).ToObject<List<string>>();
     ObjectType = target.ExtractValue<string>(Constants.SObjectType);
 }
開發者ID:maliroteh,項目名稱:SalesforceMobileSDK-Windows,代碼行數:5,代碼來源:MruSyncDownTarget.cs

示例12: SyncTarget

 protected SyncTarget(JObject target)
 {
     _idFieldName = target != null ? target.ExtractValue<string>(IdFieldName) : Constants.Id;
     _modificationDateFieldName = target != null ? target.ExtractValue<string>(ModificationDateFieldName) : Constants.LastModifiedDate;
 }
開發者ID:maliroteh,項目名稱:SalesforceMobileSDK-Windows,代碼行數:5,代碼來源:SyncTarget.cs

示例13: SoslSyncDownTarget

 public SoslSyncDownTarget(JObject target) : base(target)
 {
     this.Query = target.ExtractValue<string>(Constants.Query);
 }
開發者ID:jhsfdc,項目名稱:SalesforceMobileSDK-Windows,代碼行數:4,代碼來源:SoslSyncDownTarget.cs


注:本文中的Newtonsoft.Json.Linq.JObject.ExtractValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。