/// <summary>
        /// 创建委托
        /// </summary>
        /// <returns></returns>
        public static Func <IDeserializerReader, JsonDeserializeSetting, int, T> Register(JsonDeserializeSetting setting)
        {
            Func <IDeserializerReader, JsonDeserializeSetting, int, T> func = null;

            if (caching.TryGetValue(setting, out func))
            {
                return(func);
            }

            lock (caching)
            {
                if (caching.TryGetValue(setting, out func))
                {
                    return(func);
                }

                var customSerialierBuilder = CustomSerializationProvider.QueryCustomeDeserilizerbuilder <T>();
                if (customSerialierBuilder != null)
                {
                    func = customSerialierBuilder.Build(setting);
                    caching.TryAdd(setting, func);
                    return(func);
                }

                func = new ZzzZzDeserializerBuilder <T>().Build(setting);
                caching.TryAdd(setting, func);
                return(func);
            }
        }
Example #2
0
            /// <summary>
            /// 创建委托
            /// </summary>
            /// <returns></returns>
            public static Func <IDeserializerReader, JsonDeserializeSetting, int, T> Register(JsonDeserializeSetting setting)
            {
                if (function != null)
                {
                    return(function);
                }

                lock (locker)
                {
                    if (function != null)
                    {
                        return(function);
                    }

                    var customSerialierBuilder = CustomSerializationProvider.QueryCustomeDeserilizerbuilder <T>();
                    if (customSerialierBuilder != null)
                    {
                        return(function = customSerialierBuilder.Build(setting));
                    }

                    return(function = new ExceptionDeseralizerBuilder <T>().Build(setting));
                }
            }