예제 #1
0
        public GrpcProxyer(List <Type> servicerTypes, GrpcProxyerOptions options)
        {
            _servicerTypes  = servicerTypes;
            _proxyerOptions = options;
            _channels       = new Dictionary <string, ChannelInfo>();

            foreach (var opt in options.Addresses)
            {
                AddChannel(opt);
            }

            foreach (var servicerType in servicerTypes)
            {
                var servicerName = servicerType.FullName;
                if (!string.IsNullOrWhiteSpace(options.PackageName))
                {
                    servicerName = $"{options.PackageName}.{servicerType.Name}";
                }
                ProxyerDict.Add(servicerName, this);
            }
        }
예제 #2
0
        /// <summary>
        /// Add new grpc client for servicers.
        /// </summary>
        /// <param name="options">grpc client options</param>
        /// <returns></returns>
        public ClientBuilder AddProxyer(GrpcProxyerOptions options)
        {
            ProxyerOptions.Add(options);

            return(this);
        }