/// <summary> /// Initialize the state without delayed initialization of the JsonTypeInfo. /// </summary> public JsonConverter Initialize(Type type, JsonSerializerOptions options, bool supportContinuation) { JsonTypeInfo jsonTypeInfo = options.GetOrAddClassForRootType(type); Debug.Assert(options == jsonTypeInfo.Options); return(Initialize(jsonTypeInfo, supportContinuation)); }
/// <summary> /// Initialize the state without delayed initialization of the JsonClassInfo. /// </summary> public JsonConverter Initialize(Type type, JsonSerializerOptions options, bool supportContinuation) { JsonClassInfo jsonClassInfo = options.GetOrAddClassForRootType(type); Current.JsonClassInfo = jsonClassInfo; Current.DeclaredJsonPropertyInfo = jsonClassInfo.PropertyInfoForClassInfo; Current.NumberHandling = Current.DeclaredJsonPropertyInfo.NumberHandling; if (options.ReferenceHandler != null) { ReferenceResolver = options.ReferenceHandler !.CreateResolver(writing: true); } SupportContinuation = supportContinuation; return(jsonClassInfo.PropertyInfoForClassInfo.ConverterBase); }
public void Initialize(Type type, JsonSerializerOptions options, bool supportContinuation) { JsonClassInfo jsonClassInfo = options.GetOrAddClassForRootType(type); Current.JsonClassInfo = jsonClassInfo; // The initial JsonPropertyInfo will be used to obtain the converter. Current.JsonPropertyInfo = jsonClassInfo.PropertyInfoForClassInfo; bool preserveReferences = options.ReferenceHandler != null; if (preserveReferences) { ReferenceResolver = options.ReferenceHandler !.CreateResolver(writing: false); } SupportContinuation = supportContinuation; UseFastPath = !supportContinuation && !preserveReferences; }
/// <summary> /// Initialize the state without delayed initialization of the JsonClassInfo. /// </summary> public JsonConverter Initialize(Type type, JsonSerializerOptions options, bool supportContinuation) { JsonClassInfo jsonClassInfo = options.GetOrAddClassForRootType(type); Current.JsonClassInfo = jsonClassInfo; if ((jsonClassInfo.ClassType & (ClassType.Enumerable | ClassType.Dictionary)) == 0) { Current.DeclaredJsonPropertyInfo = jsonClassInfo.PropertyInfoForClassInfo; } if (options.ReferenceHandler != null) { ReferenceResolver = options.ReferenceHandler !.CreateResolver(writing: true); } SupportContinuation = supportContinuation; return(jsonClassInfo.PropertyInfoForClassInfo.ConverterBase); }
public void Initialize(Type type, JsonSerializerOptions options, bool supportContinuation) { JsonTypeInfo jsonTypeInfo = options.GetOrAddClassForRootType(type); Initialize(jsonTypeInfo, supportContinuation); }