Exemplo n.º 1
0
 public SignalRContractResolver()
 {
     _defaultContractSerializer =
         new Newtonsoft.Json.Serialization.DefaultContractResolver();
     _camelCaseContractResolver =
         new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();
     _assembly =
         typeof(Microsoft.AspNetCore.SignalR.Infrastructure.Connection)
         .GetTypeInfo()
         .Assembly
     ;
 }
Exemplo n.º 2
0
        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
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
 protected virtual bool TryGetJsonProperty(object target, Newtonsoft.Json.Serialization.IContractResolver contractResolver, string segment, out Newtonsoft.Json.Serialization.JsonProperty jsonProperty)
 {
     throw null;
 }
Exemplo n.º 6
0
 public virtual bool TryTraverse(object target, string segment, Newtonsoft.Json.Serialization.IContractResolver contractResolver, out object value, out string errorMessage)
 {
     throw null;
 }
Exemplo n.º 7
0
 public ObjectVisitor(Microsoft.AspNetCore.JsonPatch.Internal.ParsedPath path, Newtonsoft.Json.Serialization.IContractResolver contractResolver, Microsoft.AspNetCore.JsonPatch.Adapters.IAdapterFactory adapterFactory)
 {
 }
Exemplo n.º 8
0
 protected virtual bool TrySetDynamicObjectProperty(object target, Newtonsoft.Json.Serialization.IContractResolver contractResolver, string segment, object value, out string errorMessage)
 {
     throw null;
 }
Exemplo n.º 9
0
 public ObjectAdapter(Newtonsoft.Json.Serialization.IContractResolver contractResolver, System.Action <Microsoft.AspNetCore.JsonPatch.JsonPatchError> logErrorAction, Microsoft.AspNetCore.JsonPatch.Adapters.IAdapterFactory adapterFactory)
 {
 }
Exemplo n.º 10
0
 public virtual Microsoft.AspNetCore.JsonPatch.Internal.IAdapter Create(object target, Newtonsoft.Json.Serialization.IContractResolver contractResolver)
 {
     throw null;
 }
Exemplo n.º 11
0
 public JsonPatchDocument(System.Collections.Generic.List <Microsoft.AspNetCore.JsonPatch.Operations.Operation> operations, Newtonsoft.Json.Serialization.IContractResolver contractResolver)
 {
 }