public void ResolveDependencies(IRestContainer container)
 {
     RequestBinders             = container.Resolve <IRequestBinder>().ToArray();
     ResponseBinders            = container.Resolve <IResponseBinder>().ToArray();
     ContentMapper              = container.Required <DefaultHttpRequestContentFormatter>();
     RouteRenderer              = container.Required <RestRouteRenderer>();
     RestSerializer             = container.Required <RestSerializer>();
     DefaultCultureInfoProvider = container.Required <IDefaultCultureProvider>();
 }
Beispiel #2
0
        public RestClient(IRestContainer container)
        {
            container.AssertNotNull(nameof(container));

            _container          = container;
            _clientFactory      = _container.Required <IHttpClientFactory>();
            _executionStrategy  = _container.Required <IHttpExecutionStrategy>();
            _httpResponseMapper = _container.Required <IHttpResponseMapper>();
            _requestMapper      = _container.Required <IHttpRequestMapper>();
        }
        public EndpointProxy(IRestEndpoint endpoint, EndpointMetadata metadata, IRestContainer components)
        {
            endpoint.AssertNotNull(nameof(endpoint));
            metadata.AssertNotNull(nameof(metadata));
            components.AssertNotNull(nameof(components));

            _endpoint         = endpoint;
            _metadata         = metadata;
            _modelMapper      = components.Required <RestModelMapper>();
            _resultValidators = components.Resolve <IInvocatioтFilter>().ToList();
        }
Beispiel #4
0
        public TContract CreateProxy <TContract>(Action <EndpointProxyBuilder> proxyConfigurator)
            where TContract : class
        {
            var proxyType        = ProxyFactory.GetProxyType <EndpointProxy, TContract>();
            var metadataProvider = _container.Required <RestMetadataProvider>();
            var valuesProvider   = new MetadataValueProvider();
            var metadata         = metadataProvider.GetEndpointMetadata(typeof(TContract), valuesProvider);

            var proxyBuilder = new RestContainerBuilder(_container);

            proxyBuilder.Register <DefaultRequestBinder>();
            proxyBuilder.Register <DefaultResponseBinder>();
            proxyBuilder.Register <DefaultRequestQueryValueFormatter>();
            proxyBuilder.Register <DefaultRequestRouteValueFormatter>();
            proxyBuilder.Register <RestModelMapper>();

            proxyConfigurator?.Invoke(new EndpointProxyBuilder(proxyBuilder));

            var proxyContainer = proxyBuilder.CreateContainer();
            var proxy          = Activator.CreateInstance(proxyType, new object[] { this, metadata, proxyContainer });

            return((TContract)proxy);
        }
 public void ResolveDependencies(IRestContainer container)
 {
     ContentMapper  = container.Required <HttpRequestContentMapper>();
     RouteRenderer  = container.Required <RestRouteRenderer>();
     RestSerializer = container.Required <RestSerializer>();
 }
 public void ResolveDependencies(IRestContainer container)
 {
     RestSerializer = container.Required <RestSerializer>();
 }
Beispiel #7
0
 public void ResolveDependencies(IRestContainer container)
 {
     DefaultEncodingProvider  = container.Required <IDefaultEncodingProvider>();
     DefaultMediaTypeProvider = container.Required <IDefaultMediaTypeProvider>();
 }
Beispiel #8
0
 public void ResolveDependencies(IRestContainer container)
 {
     _logger = container.Required <IRestLogger>();
 }