using FHT.Agency.Web.CommandServices; using FHT.Core.Agency.Interfaces; using IO.Swagger.Api; using IO.Swagger.Client; using Ninject; using System; using System.Collections.Generic; using System.Net.Http; namespace FHT.Agency.Web { public static class AgentApiNinjectConfiguration { public static void AddBindings(IKernel _kernel) { // _kernel.Unbind(); _kernel.Bind().To().InSingletonScope(); _kernel.Bind().To().InSingletonScope(); _kernel.Bind().To().InSingletonScope(); _kernel.Bind().To().InSingletonScope(); _kernel.Bind().To().InSingletonScope(); _kernel.Bind().To().InSingletonScope(); var httpClient = new HttpClient() { BaseAddress = new Uri(AgentApplicationEnvironment.FhtApiHost) }; var apiClient = new ApiClient(httpClient); var config = new Configuration(apiClient) { DefaultHeader = new Dictionary { { "User-Agent", "agencycommand" } }, }; _kernel.Bind().ToConstant(config); _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().ToSelf().InSingletonScope(); } } }