private object ConvertDataFromResource(object value, ApiInvokeOptions invokeOptions) { // try convert json if (Util.IsJsonString(value as string)) { try { value = JsonConvert.DeserializeObject((string)value); if (UseCamelCase) { Util.CamelizeJToken(value as JToken); } } catch { } } return(value); }
private void ReadRecordset(SpCallResult spCallResult, CommandResultTable commandResultTable, SpInfo spInfo, ApiInvokeOptions invokeOptions) { // Build return recordsetFields var fieldInfos = new List <FieldInfo>(commandResultTable.Fields.Length); for (int i = 0; i < commandResultTable.Fields.Length; i++) { fieldInfos.Add(new FieldInfo() { Name = commandResultTable.Fields[i].Name, TypeName = commandResultTable.Fields[i].TypeName, ExtendedProps = spInfo.ExtendedProps.Fields.TryGetValue(commandResultTable.Fields[i].Name, out SpFieldInfo spRecodsetFiled) ? spRecodsetFiled : null });
private object ConvertDataForResource(object value, SpParamInfo param, SpParamInfoEx paramEx, ApiInvokeOptions invokeOptions) { //fix UserString if (value is string valueString) { value = StringHelper.FixUserString(valueString); } if (param.SystemTypeName.ToLower() == "uniqueidentifier") { return(Guid.Parse(value as string)); } if (value is JToken || value is System.Collections.ICollection) //string is an IEnumerable { if (UseCamelCase) { Util.PascalizeJToken(value as JToken); } value = JsonConvert.SerializeObject(value); } return(value); }