Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="paramName"></param>
        /// <returns></returns>
        public static object[] TryGetParams(string paramName)
        {
            if (string.IsNullOrEmpty(paramName))
            {
                return(null);
            }

            return(Cache.TryGetCache <object[]>(paramName, new Func <object[]>(delegate()
            {
                bool hasParamCreatorInfos;
                object ret = ParamCreatorHelper.CreateParam(paramName, out hasParamCreatorInfos);
                if (!hasParamCreatorInfos)
                {
                    string[] ss = paramName.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    return ss;
                }

                if (ret is object[])
                {
                    return ret as object[];
                }
                else
                {
                    return new object[] { ret };
                }
            })));
        }
Example #2
0
        /// <summary>
        /// 根据名字创建参数。如不在表AD_Param_Creator中,则直接返回paramName(为了和以前兼容)
        /// </summary>
        /// <param name="paramName"></param>
        /// <returns></returns>
        public static object TryGetParam(string paramName)
        {
            if (string.IsNullOrEmpty(paramName))
            {
                return(null);
            }
            if (paramName.IndexOf(' ') >= 0)    // 如果包含空格,则肯定不是ParamName
            {
                return(paramName);
            }

            return(Cache.TryGetCache <object>(paramName, new Func <object>(delegate()
            {
                bool hasParamCreatorInfos;
                object ret = ParamCreatorHelper.CreateParam(paramName, out hasParamCreatorInfos);
                if (!hasParamCreatorInfos)
                {
                    return paramName;
                }

                return ret;
            })));
        }