Пример #1
0
        public ServiceManifestElement Read(
            IServicePackage package)
        {
            if (package is null)
            {
                throw new ArgumentNullException(nameof(package));
            }

            using (var manifestStream = package.GetManifestStream())
            {
                var manifest = DeserializeElement <ServiceManifestElement>(manifestStream);
                manifest.PackageRoot = package.Path;

                foreach (var configurationPackage in manifest.ConfigurationPackages)
                {
                    using (var settingsStream = package.GetSettingsStream(configurationPackage.Name))
                    {
                        if (settingsStream is null)
                        {
                            continue;
                        }

                        configurationPackage.Settings = DeserializeElement <ConfigurationSettingsElement>(settingsStream);
                    }
                }

                return(manifest);
            }
        }
Пример #2
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();
        }
Пример #3
0
        /// <summary>
        /// 移除服务
        /// </summary>
        /// <param name="package"></param>
        public static void RemovePackage(IServicePackage package)
        {
            ClientBizBus cbizbus = bizbus as ClientBizBus;

            cbizbus.packages.Remove(package);
            cbizbus.IndexPackage();
        }
Пример #4
0
 public ServiceManifestProvider(
     IServicePackage package,
     IServiceManifestReader manifestReader)
 {
     this.package        = package ?? throw new ArgumentNullException(nameof(package));
     this.manifestReader = manifestReader ?? throw new ArgumentNullException(nameof(manifestReader));
 }
Пример #5
0
 /// <summary>
 /// 移除服务包对象
 /// </summary>
 /// <returns></returns>
 public void RemoveServicePackage(IServicePackage servicePackage)
 {
     lock (servicePackages)
     {
         if (this.servicePackages.Contains(servicePackage))
         {
             this.servicePackages.Remove(servicePackage);
         }
     }
 }
Пример #6
0
 /// <summary>
 /// 添加服务包对象
 /// </summary>
 /// <returns></returns>
 public void AddServicePackage(IServicePackage servicePackage)
 {
     lock (servicePackages)
     {
         if (!this.servicePackages.Contains(servicePackage))
         {
             this.servicePackages.Add(servicePackage);
         }
     }
 }