Example #1
0
        /// <summary>
        /// 服务订阅
        /// </summary>
        /// <param name="serviceSubscriber"></param>
        /// <param name="serviceProxyTypes">服务代理类型列表</param>
        /// <param name="useNewClient">是否强制使用新的NodeClient,当为false时会多个服务代理共享一个NodeClient实例</param>
        /// <returns></returns>
        public static IServiceSubscriber Subscribe(this IServiceSubscriber serviceSubscriber, IEnumerable <Type> serviceProxyTypes, bool useNewClient = false)
        {
            foreach (var serviceProxyType in serviceProxyTypes)
            {
                serviceSubscriber.Subscribe(serviceProxyType, useNewClient);
            }

            return(serviceSubscriber);
        }
Example #2
0
        /// <summary>
        /// 服务订阅
        /// </summary>
        /// <param name="serviceSubscriber"></param>
        /// <param name="useNewClient">是否强制使用新的NodeClient,当为false时会多个服务代理共享一个NodeClient实例</param>
        /// <returns></returns>
        public static IServiceSubscriber Subscribe <ServiceProxyType>(this IServiceSubscriber serviceSubscriber, bool useNewClient = false)
        {
            var serviceProxyType = typeof(ServiceProxyType);

            return(serviceSubscriber.Subscribe(serviceProxyType, useNewClient));
        }