Пример #1
0
        /// <summary>
        /// 初始化服务总线(本地调用不走WCF服务)
        /// </summary>
        public static void InitializeClientBus()
        {
            if (bizbus == null)
            {
                bizbus = new ClientBizBus();
            }

            ClientBizBus cbizbus = bizbus as ClientBizBus;

            List <ServicePackageInfo> packageinfos = ConfigLoader.GetPackageList();
            ServicePackageLoader      loader       = new ServicePackageLoader();
            ServicePackageList        packages     = new ServicePackageList();

            foreach (ServicePackageInfo info in packageinfos)
            {
                IServicePackage package = PackageConverter.Convert2Package(info);
                if (package == null)
                {
                    continue;
                }
                packages.Add(package);
            }
            cbizbus.packages = packages;
            cbizbus.IndexPackage();
        }
Пример #2
0
        /// <summary>
        /// 加入服务列表
        /// </summary>
        /// <param name="packages"></param>
        public void IndexPackageList(ServicePackageList packages)
        {
            dicPackage.Clear();
            dicDefault.Clear();

            foreach (IServicePackage package in packages)
            {
                foreach (ServiceDesc sd in package.ReadOnlyServices)
                {
                    ServiceKey key = new ServiceKey(sd);
                    dicPackage.Add(key, sd);
                }
                foreach (ServiceKey key in package.ReadOnlyDefaultServices)
                {
                    dicDefault.Add(key.ServiceType, dicPackage[key]);
                }
            }
        }