public void InitializeRoot(Type type, JsonSerializerOptions options) { JsonClassInfo jsonClassInfo = options.GetOrAddClass(type); Debug.Assert(jsonClassInfo.ClassType != ClassType.Invalid); Current.JsonClassInfo = jsonClassInfo; // The initial JsonPropertyInfo will be used to obtain the converter. Current.JsonPropertyInfo = jsonClassInfo.PolicyProperty !; if (options.ReferenceHandling.ShouldReadPreservedReferences()) { ReferenceResolver = new DefaultReferenceResolver(writing: false); } }
public void Initialize(Type type, JsonSerializerOptions options, bool supportContinuation) { JsonClassInfo jsonClassInfo = options.GetOrAddClass(type); Current.JsonClassInfo = jsonClassInfo; // The initial JsonPropertyInfo will be used to obtain the converter. Current.JsonPropertyInfo = jsonClassInfo.PropertyInfoForClassInfo; if (options.ReferenceHandling.ShouldReadPreservedReferences()) { ReferenceResolver = new DefaultReferenceResolver(writing: false); } SupportContinuation = supportContinuation; }
/// <summary> /// Initialize the state without delayed initialization of the JsonClassInfo. /// </summary> public void Initialize(Type type, JsonSerializerOptions options, bool supportContinuation) { JsonClassInfo jsonClassInfo = options.GetOrAddClass(type); Current.JsonClassInfo = jsonClassInfo; if ((jsonClassInfo.ClassType & (ClassType.Enumerable | ClassType.Dictionary)) == 0) { Current.DeclaredJsonPropertyInfo = jsonClassInfo.PropertyInfoForClassInfo; } if (options.ReferenceHandling.ShouldWritePreservedReferences()) { ReferenceResolver = new DefaultReferenceResolver(writing: true); } SupportContinuation = supportContinuation; }