当前位置: 首页>>代码示例>>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;未经允许,请勿转载。