public void Lamar() { var services = new ServiceCollection(); services.AddHttpClient("client") .AddHttpMessageHandler <RequestContentMd5Handler>() .AddHttpMessageHandler <HmacSigningHandler>(); var container = new Lamar.Container(services); container.Configure(config => { config.AddSingleton <ISecretRepository, SecretStore>(); config.AddTransient <ISignatureCalculator, HmacSignatureCalculator>(); config.AddTransient <IMessageRepresentationBuilder, HmacMessageRepresentationBuilder>(); config.AddTransient <RequestContentMd5Handler>(); }); var serviceProvider = container.GetInstance <IServiceProvider>(); var factory = serviceProvider.GetService <IHttpClientFactory>(); factory.CreateClient("client"); }
public void AddModule(IOCModule module) { if (module is null) { throw new ArgumentNullException(nameof(module)); } var services = module.GetServices(); container.Configure(services); }