예제 #1
0
 /// <summary>
 /// Adds concrete implementations necessary for running of the application to the service collection for a single client.
 /// </summary>
 /// <param name="services">The service collection.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="clientName">The name of the client.</param>
 /// <param name="tokenFlow">The token flow.</param>
 public static IHttpClientBuilder UseCommercetools(this Container services, IConfiguration configuration, string clientName = DefaultClientNames.Api, TokenFlow tokenFlow = TokenFlow.ClientCredentials)
 {
     return(services.UseCommercetools(configuration, new Dictionary <string, TokenFlow>()
     {
         { clientName, tokenFlow }
     }).Single().Value);
 }
        /// <summary>
        /// Adds concrete implementations necessary for running of the application to the service collection for a single client.
        /// </summary>
        /// <param name="services">The service collection.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="clientName">The name of the client.</param>
        /// <param name="tokenFlow">The token flow.</param>
        public static IHttpClientBuilder UseCommercetools(this Container services, IConfiguration configuration,
                                                          string clientName = DefaultClientNames.Api, TokenFlow tokenFlow = TokenFlow.ClientCredentials)
        {
            var clients = new ConcurrentDictionary <string, TokenFlow>();

            clients.TryAdd(clientName, tokenFlow);
            return(services
                   .UseCommercetools(configuration, clients).Single()
                   .Value);
        }