Пример #1
0
        private static RpcClientProxy GetProxyInner(ServerUri solvedUri, ResolvableUri toUri, string serviceName)
        {
            if (_channels.Count == 0)
            {
                throw new Exception("You *MUST* Register at least 1 client channel at first");
            }

            IRpcClientChannel channel;

            if (!_channels.TryGetValue(solvedUri.Protocol, out channel))
            {
                throw new Exception(string.Format("{0} protocol:'{1}' not found", solvedUri.ToString(), solvedUri.Protocol));
            }

            RpcProxyNexus nexus;

            lock (_syncRoot) {
                if (!_nexuses.TryGetValue(solvedUri, out nexus))
                {
                    ResolvableUri r           = toUri as ResolvableUri;
                    string        serviceRole = r != null ? r.Service : "";
                    nexus = new RpcProxyNexus(channel, solvedUri, serviceRole);
                    _nexuses.Add(solvedUri, nexus);
                }
            }

            RpcClientProxy proxy = new RpcClientProxy(nexus, serviceName, toUri);

            return(proxy);
        }
Пример #2
0
 internal RpcClientProxy(RpcProxyNexus nexus, string serviceName, BaseUri toUri)
 {
     _toUri       = toUri;
     _nexus       = nexus;
     _serviceName = serviceName;
     // p_serviceUrl = channel.FormatUrl(uri, p_serviceName);
     // p_from = ServiceEnviornment.ServiceName + "@" + ServiceEnviornment.ComputerName;
     // p_to = p_serviceUrl;
 }