public static T GetClient <T>(string serverIp, int port) where T : class { var clientProxy = new RPCClientProxy { _serverIp = serverIp, _serverPort = port, ServiceType = typeof(T), ServiceName = typeof(T).FullName }; return(clientProxy.ActLike <T>()); }
public static T GetClient <T>(string serverIp, int port) where T : class { T service = null; string key = $"{typeof(T).FullName}-{serverIp}-{port}"; try { service = (T)_services[key]; } catch { var clientProxy = new RPCClientProxy { ServerIp = serverIp, ServerPort = port, ServiceType = typeof(T), ServiceName = typeof(T).FullName }; service = clientProxy.ActLike <T>(); _services[key] = service; } return(service); }