Beispiel #1
0
 public static void ConfigurePerformanceTest(this IDependencyBuilder builder)
 {
     builder.Bind <PerformanceMethodTest>().Resolve <IPerformanceMethodTest>();
     builder.BindFunction((ctx) => PerformanceMethodTest.Method()).Resolve <IPerformanceMethodResultTest>();
     builder.Bind <PerformanceConstructParamTest>().Resolve <IPerformanceConstructParam1Test>();
     builder.Bind <PerformanceConstructParamTest>().Resolve <IPerformanceConstructParam2Test>();
     builder.Bind <PerformanceConstructParamTest>().Resolve <IPerformanceConstructParam3Test>();
     builder.Bind <PerformanceConstructTest>().Resolve <IPerformanceConstructTest>();
     builder.Bind <PerformanceSingletonTest>().Resolve <IPerformanceSingletonTest>().InSingletonScope();
     builder.BindInstance(new PerformanceInstanceTest()).Resolve <IPerformanceInstanceTest>();
 }
Beispiel #2
0
        /// <summary>
        /// Configure the API HTTP factory for the solution.
        /// </summary>
        /// <param name="builder">The dependency builder.</param>
        /// <param name="handlerFactory">Specify the handler factory.</param>
        /// <returns></returns>
        public static IDependencyBuilder ConfigureHttp(this IDependencyBuilder builder, IApiHttpHandlerFactory handlerFactory)
        {
            if (handlerFactory is null)
            {
                throw new ArgumentNullException(nameof(handlerFactory));
            }

            ApiHttpFactory.Instance = new ApiHttpFactory(new System.Net.Http.HttpClient(), handlerFactory, new ApiHttpRequestHandlerBindingMap());

            builder.BindInstance(ApiHttpFactory.Instance).Resolve <IApiHttpFactory>();
            builder.BindFunction((ctx) => ApiHttpFactory.Instance.NewClient(ctx.Info.Key)).Resolve <IApiHttpClient>().InTransientScope();

            return(builder);
        }