Пример #1
0
        /// <summary>
        /// 发布配置
        /// </summary>
        /// <returns></returns>
        public static bool DeployConfigure(long mstPhid)
        {
            var data = AddinCache.GetCfg(mstPhid);

            if (data == null)
            {
                return(false);
            }

            data.MstModel.DeployFlag = 1;
            return(AddinCache.AddDeployedCfg(data.MstModel.Phid, data));
        }
Пример #2
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="session"></param>
        public static void Init(ISession session)
        {
            if (_inited)
            {
                return;
            }
            lock (lockobject)
            {
                //所有服务加入到缓存中
                var serviceData = LoadAllPluginService(session);
                serviceData.ToList().ForEach(p => { AddinCache.AddService(p.Phid, p); });


                if (_inited)
                {
                    return;
                }
                IList <MethodAroundBizModel> configures = LoadAllPluginConfigureFromDataSource(session);


                foreach (var item in configures)
                {
                    //通过ID填充Service记录
                    var service = AddinCache.GetService(item.MstModel.TargetServiceId);
                    if (service != null)
                    {
                        item.MstModel.TargetAssemblyName = service.TargetAssemblyName;
                        item.MstModel.TargetClassName    = service.TargetClassName;
                        item.MstModel.TargetMethodName   = service.TargetMethodName;
                    }
                    AddinCache.AddCfg(item.MstModel.Phid, item);
                }

                //已经发布了的程序
                var deployconfigures = configures.Where(p => p.MstModel.DeployFlag == 1).ToList();
                foreach (var item in deployconfigures)
                {
                    AddinCache.AddDeployedCfg(item.MstModel.Phid, item);
                }
                _inited = true; //设置初始化完成标志
            }
        }