コード例 #1
0
        /// <summary>解决类类型</summary>
        /// <param name="bindData"></param>
        /// <param name="parent"></param>
        /// <param name="info">参数信息</param>
        /// <returns></returns>
        private object ResloveClass(CBindData bindData, Type parent, ParameterInfo info)
        {
            object obj = null;

            if (info.ParameterType == typeof(CConfig))
            {
                if (config == null)
                {
                    this.InitConfig();
                }
                if (config.ContainsKey(parent))
                {
                    obj = config[parent];
                }
            }
            else
            {
                obj = this.Make(bindData.GetContextual(info.ParameterType.ToString()), null);
            }

            if (obj == null)
            {
                return(info.DefaultValue);
            }
            return(obj);
        }
コード例 #2
0
        /// <summary>解决类类型</summary>
        /// <returns></returns>
        private object ResloveClassAttr(CBindData bindData, Type parent, string cls)
        {
            object obj = null;

            if (cls == typeof(CConfig).ToString())
            {
                if (config == null)
                {
                    this.InitConfig();
                }
                if (config.ContainsKey(parent))
                {
                    obj = config[parent];
                }
            }
            else
            {
                obj = Make(bindData.GetContextual(cls));
            }

            return(obj);
        }