public ICommandDispatcher Create(Uri uri, HttpMethod httpMethod = null, Func <string> authenticationHeaderContent = null, HttpDispatchErrorHandler httpDispatchErrorHandler = null) { return(new HttpCommandDispatcher(new HttpCommandExecuter( uri, httpMethod, authenticationHeaderContent, _httpCommandSerializer, _uriCommandQueryBuilder, _httpClientProvider, httpDispatchErrorHandler))); }
/// <summary> /// Will create a HTTP command dispatcher. Note if you've supplied a HttpClient to the AddHttpCommanding methods then you /// should use resolve an instance if IHttpCommandDispatcherFactory and use that instances create method to create a /// command dispatcher /// </summary> /// <param name="uri">The uri the command should be sent to</param> /// <param name="httpMethod">The verb to send the command with</param> /// <param name="authenticationHeaderContent">The content of the authentication header (null if none require)</param> /// <param name="serializer">An optional serializer. If unspecified the default JSON serializer will be used.</param> /// <param name="uriCommandQueryBuilder">An optional URI command query builder. If unspecified the default command query builder will be used.</param> /// <returns></returns> public static Func <ICommandDispatcher> Create( Uri uri, HttpMethod httpMethod = null, Func <string> authenticationHeaderContent = null, IHttpCommandSerializer serializer = null, IUriCommandQueryBuilder uriCommandQueryBuilder = null, HttpDispatchErrorHandler httpDispatchErrorHandler = null) { return(() => new HttpCommandDispatcherFactoryImpl( serializer ?? new JsonCommandSerializer(), uriCommandQueryBuilder ?? new UriCommandQueryBuilder(), HttpClientProvider).Create(uri, httpMethod, authenticationHeaderContent, httpDispatchErrorHandler)); }
public static void RegisterHttpCommand <TCommand, TResult>(this ICommandRegistry registry, Uri uri, HttpMethod httpMethod = null, Func <string> authenticationHeaderContent = null, IHttpCommandSerializer httpCommandSerializer = null, IUriCommandQueryBuilder uriCommandQueryBuilder = null, HttpDispatchErrorHandler httpDispatchErrorHandler = null) where TCommand : ICommand <TResult> { registry.Register <TCommand, TResult>(() => new HttpCommandDispatcher(new HttpCommandExecuter( uri, httpMethod, authenticationHeaderContent, httpCommandSerializer ?? new JsonCommandSerializer(), uriCommandQueryBuilder ?? new UriCommandQueryBuilder(), HttpCommandingDependencies.HttpClientProvider, httpDispatchErrorHandler))); }
public HttpCommandExecuter(Uri uri, HttpMethod httpMethod, Func <string> authenticationHeaderContent, IHttpCommandSerializer serializer, IUriCommandQueryBuilder uriCommandQueryBuilder, IHttpClientProvider httpClientProvider, HttpDispatchErrorHandler httpDispatchErrorHandler) { _uri = uri; _httpMethod = httpMethod ?? HttpMethod.Post; _authenticationHeaderContent = authenticationHeaderContent; _serializer = serializer; _uriCommandQueryBuilder = uriCommandQueryBuilder; _httpClientProvider = httpClientProvider; _httpDispatchErrorHandler = httpDispatchErrorHandler; }