public SignalRContractResolver() { _defaultContractSerializer = new Newtonsoft.Json.Serialization.DefaultContractResolver(); _camelCaseContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver(); _assembly = typeof(Microsoft.AspNetCore.SignalR.Infrastructure.Connection) .GetTypeInfo() .Assembly ; }
public static void Serialize(object value, System.IO.Stream s, Newtonsoft.Json.Serialization.IContractResolver resolver) { using (System.IO.StreamWriter writer = new System.IO.StreamWriter(s, System.Text.Encoding.UTF8)) using (Newtonsoft.Json.JsonTextWriter jsonWriter = new Newtonsoft.Json.JsonTextWriter(writer)) { Newtonsoft.Json.JsonSerializer ser = new Newtonsoft.Json.JsonSerializer(); ser.Formatting = Newtonsoft.Json.Formatting.Indented; if (resolver != null) { ser.ContractResolver = resolver; } ser.Serialize(jsonWriter, value); jsonWriter.Flush(); }// End Using jsonWriter } // End Sub Serialize
private void SetExceptionFieldValue(Newtonsoft.Json.Linq.JObject jObject, string propertyName, object value, string fieldName, Newtonsoft.Json.Serialization.IContractResolver resolver, Newtonsoft.Json.JsonSerializer serializer) { var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(System.Exception)).GetDeclaredField(fieldName); var jsonPropertyName = resolver is Newtonsoft.Json.Serialization.DefaultContractResolver ? ((Newtonsoft.Json.Serialization.DefaultContractResolver)resolver).GetResolvedPropertyName(propertyName) : propertyName; var property = System.Linq.Enumerable.FirstOrDefault(jObject.Properties(), p => System.String.Equals(p.Name, jsonPropertyName, System.StringComparison.OrdinalIgnoreCase)); if (property != null) { var fieldValue = property.Value.ToObject(field.FieldType, serializer); field.SetValue(value, fieldValue); } }
private void SetExceptionFieldValue(Newtonsoft.Json.Linq.JObject jObject, string propertyName, object value, string fieldName, Newtonsoft.Json.Serialization.IContractResolver resolver, Newtonsoft.Json.JsonSerializer serializer) { var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(System.Exception)).GetDeclaredField(fieldName); var jsonPropertyName = resolver is Newtonsoft.Json.Serialization.DefaultContractResolver ? ((Newtonsoft.Json.Serialization.DefaultContractResolver)resolver).GetResolvedPropertyName(propertyName) : propertyName; if (jObject[jsonPropertyName] != null) { var fieldValue = jObject[jsonPropertyName].ToObject(field.FieldType, serializer); field.SetValue(value, fieldValue); } }
protected virtual bool TryGetJsonProperty(object target, Newtonsoft.Json.Serialization.IContractResolver contractResolver, string segment, out Newtonsoft.Json.Serialization.JsonProperty jsonProperty) { throw null; }
public virtual bool TryTraverse(object target, string segment, Newtonsoft.Json.Serialization.IContractResolver contractResolver, out object value, out string errorMessage) { throw null; }
public ObjectVisitor(Microsoft.AspNetCore.JsonPatch.Internal.ParsedPath path, Newtonsoft.Json.Serialization.IContractResolver contractResolver, Microsoft.AspNetCore.JsonPatch.Adapters.IAdapterFactory adapterFactory) { }
protected virtual bool TrySetDynamicObjectProperty(object target, Newtonsoft.Json.Serialization.IContractResolver contractResolver, string segment, object value, out string errorMessage) { throw null; }
public ObjectAdapter(Newtonsoft.Json.Serialization.IContractResolver contractResolver, System.Action <Microsoft.AspNetCore.JsonPatch.JsonPatchError> logErrorAction, Microsoft.AspNetCore.JsonPatch.Adapters.IAdapterFactory adapterFactory) { }
public virtual Microsoft.AspNetCore.JsonPatch.Internal.IAdapter Create(object target, Newtonsoft.Json.Serialization.IContractResolver contractResolver) { throw null; }
public JsonPatchDocument(System.Collections.Generic.List <Microsoft.AspNetCore.JsonPatch.Operations.Operation> operations, Newtonsoft.Json.Serialization.IContractResolver contractResolver) { }