コード例 #1
0
        /// <summary>
        /// 取得缓存对象列表
        /// </summary>
        /// <returns></returns>
        public static IList <MethodAroundBizModel> GetDeployedCfgList(string key)
        {
            IList <MethodAroundBizModel> models = new List <MethodAroundBizModel>();

            foreach (var item in _deployconfigures.Keys)
            {
                var data = _deployconfigures[item];
                AddinConfigureEntityKey entityKey = new AddinConfigureEntityKey
                                                        (data.MstModel.TargetClassName, data.MstModel.TargetMethodName, data.MstModel.InterceptorType);

                if (entityKey.ToString() == key)
                {
                    models.Add(data);
                }
            }
            return(models);
        }
コード例 #2
0
        public static void SaveServiceRequestParam(AddinMethodInvocation invocation)
        {
            var    requestParams = RequestParams();
            string className     = invocation.Target.ToString();
            string method        = invocation.Method.Name;

            AddinConfigureEntityKey entityKey = new AddinConfigureEntityKey(className, method, EnumInterceptorType.None);

            foreach (string param in requestParams)
            {
                //key
                string key = entityKey.GetKey() + "_" + param;
                ServiceUIParamBizModel model = new ServiceUIParamBizModel {
                    ClassName = className, MethodName = method, ParamName = param, ParamValue = requestParams[param]
                };
                AddinCache.AddUIParam(key, model);
            }
        }
コード例 #3
0
        private static IList <MethodAroundBizModel> GetPluginConfigure(AddinConfigureEntityKey entityKey)
        {
            if (!_inited)
            {
                return(null);
            }

            var bizModel = AddinCache.GetDeployedCfgList(entityKey.GetKey());

            if (bizModel.Count != 0)
            {
                return(bizModel);
            }

            if (AddinOperator.CurrentUserIsOperator())
            {
                //如果是未发布,但是测试人员可以进行测试
                bizModel = AddinCache.GetCfgList(entityKey.GetKey());
            }
            return(bizModel);
        }
コード例 #4
0
        /// <summary>
        /// 根据调用信息获取注入信息
        /// </summary>
        /// <param name="methodName"></param>
        /// <param name="args"></param>
        /// <param name="target"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static MethodAroundBizModel GetPluginConfigure(string methodName, object[] args, object target, EnumInterceptorType type)
        {
            AddinConfigureEntityKey entityKey = new AddinConfigureEntityKey
                                                    (target.ToString(), methodName, type);

            //取不到配置信息
            var entitys = AddinConfigure.GetPluginConfigure(entityKey);

            if (entitys.Count == 0)
            {
                return(null);
            }

            //如果只有一个则直接返回
            if (entitys.Count == 1)
            {
                return(entitys[0]);
            }

            foreach (var entity in entitys)
            {
                //如果判断
                var service = AddinCache.GetService(entity.MstModel.TargetServiceId);
                if (service == null)
                {
                    LogHelper <AddinServiceModel> .Info("In AddinConfigure GetPluginConfigure method 通过addin_method_m中的servicePHid未能取得对应的service");

                    return(null);
                }

                string matchCondition = service.MatchCondition;
                //如果不存在条件则直接返回
                if (string.IsNullOrEmpty(matchCondition))
                {
                    continue;
                }

                string[] eles = matchCondition.Split(new char[] { ':' });
                if (eles.Length != 2)
                {
                    LogHelper <AddinServiceModel> .Info("In AddinConfigure GetPluginConfigure method 条件定义出错" + matchCondition);

                    continue;
                }
                int index = -1;
                if (!int.TryParse(eles[0].Trim(), out index))
                {
                    LogHelper <AddinServiceModel> .Info("In AddinConfigure GetPluginConfigure method 条件定义出错" + matchCondition);

                    continue;
                }

                if (index < 0 || index > args.Length)
                {
                    LogHelper <AddinServiceModel> .Info("In AddinConfigure GetPluginConfigure method 条件定义出错" + matchCondition);

                    continue;
                }
                if (args[index] == null)
                {
                    LogHelper <AddinServiceModel> .Info(string.Format("In AddinConfigure GetPluginConfigure args{0} is null", index));

                    continue;
                }

                if (!args[index].ToString().Equals(eles[1], StringComparison.OrdinalIgnoreCase))
                {
                    LogHelper <AddinServiceModel> .Info(string.Format("In AddinConfigure GetPluginConfigure args{0} is {1},MatchCondition value {2}", index, args[index].ToString(), eles[1]));

                    continue;
                }
                return(entity);
            }

            return(null);
        }