예제 #1
0
        public async Task <T> Invoke <T>(IDictionary <string, object> parameters, string routePath, string serviceKey)
        {
            var serviceRoute = await _serviceRouteProvider.GetRouteByPath(routePath.ToLower());

            T result = default(T);

            if (!string.IsNullOrEmpty(serviceKey))
            {
                // var proxy = ServiceResolver.Current.GetService<RemoteServiceProxy>(serviceKey);

                //if (proxy == null)
                //{
                //    proxy = new RemoteServiceProxy(serviceKey, _serviceProvider);
                //    ServiceResolver.Current.Register(serviceKey, proxy);
                //}
                var proxy = new RemoteServiceProxy(serviceKey, _serviceProvider);
                result = await proxy.Invoke <T>(parameters, serviceRoute.ServiceDescriptor.Id);
            }
            else
            {
                //var proxy = ServiceResolver.Current.GetService<RemoteServiceProxy>();

                //if (proxy == null)
                //{
                //    proxy = new RemoteServiceProxy(null, _serviceProvider);
                //    ServiceResolver.Current.Register(null, proxy);
                //}
                var proxy = new RemoteServiceProxy(null, _serviceProvider);
                result = await proxy.Invoke <T>(parameters, serviceRoute.ServiceDescriptor.Id);
            }
            return(result);
        }
예제 #2
0
        public async Task <T> Invoke <T>(IDictionary <string, object> parameters, string routePath, string serviceKey)
        {
            var serviceRoute = await _serviceRouteProvider.GetRouteByPath(routePath.ToLower());

            T result = default(T);

            if (!string.IsNullOrEmpty(serviceKey))
            {
                var proxy = new RemoteServiceProxy(serviceKey, _serviceProvider);
                result = await proxy.Invoke <T>(parameters, serviceRoute.ServiceDescriptor.Id);
            }
            else
            {
                var proxy = new RemoteServiceProxy(null, _serviceProvider);
                result = await proxy.Invoke <T>(parameters, serviceRoute.ServiceDescriptor.Id);
            }
            return(result);
        }
예제 #3
0
        public async Task <T> Invoke <T>(IDictionary <string, object> parameters, string routePath)
        {
            var serviceRoute = await _serviceRouteProvider.GetRouteByPath(routePath.ToLower());

            T result = default(T);

            if (parameters.ContainsKey("serviceKey"))
            {
                var proxy = new RemoteServiceProxy(parameters["serviceKey"].ToString(), _serviceProvider);
                result = await proxy.Invoke <T>(parameters, serviceRoute.ServiceDescriptor.Id);
            }
            else
            {
                var proxy = new RemoteServiceProxy(null, _serviceProvider);
                result = await proxy.Invoke <T>(parameters, serviceRoute.ServiceDescriptor.Id);
            }
            return(result);
        }