コード例 #1
0
ファイル: WriteStack.cs プロジェクト: z77ma/runtime
        /// <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));
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
ファイル: ReadStack.cs プロジェクト: PRIMETSS/runtime
        public void Initialize(Type type, JsonSerializerOptions options, bool supportContinuation)
        {
            JsonTypeInfo jsonTypeInfo = options.GetOrAddClassForRootType(type);

            Initialize(jsonTypeInfo, supportContinuation);
        }