Ejemplo n.º 1
0
        public static VirtualCompanionBuilder AddContextProcess <TContextProcess>(this VirtualCompanionBuilder builder)
            where TContextProcess : class, IVirtualCompanionExecutionContextProcessorHandler
        {
            builder.Services.AddTransient <IVirtualCompanionExecutionContextProcessorHandler, TContextProcess>();

            return(builder);
        }
Ejemplo n.º 2
0
        public static VirtualCompanionBuilder SetContextFactory <TContextFactory>(this VirtualCompanionBuilder builder)
            where TContextFactory : class, IVirtualCompanionExecutionContextFactory
        {
            builder.Services.AddTransient <IVirtualCompanionExecutionContextFactory, TContextFactory>();

            return(builder);
        }
        private static VirtualCompanionBuilder AddHttp(this VirtualCompanionBuilder builder)
        {
            builder.Services.TryAddTransient <IVirtualCompanionExecutionContextSerializer, JsonVirtualCompanionExecutionContextSerializer>();
            builder.Services.TryAddTransient <IJsonSerializerSettingsProvider, JsonSerializerSettingsProvider>();
            builder.Services.TryAddTransient <IJsonConvertersProvider, JsonConvertersProvider>();

            return(builder);
        }
Ejemplo n.º 4
0
        public static VirtualCompanionBuilder ConfigureContext(this VirtualCompanionBuilder builder, Action <VirtualCompanionExecutionContextConfiguration> setup)
        {
            builder.Services.Configure <VirtualCompanionExecutionContextConfiguration>((o) => {
                setup.Invoke(o);
            });

            return(builder);
        }
        public static VirtualCompanionBuilder SetJsonConvertersProvider <TJsonConvertersProvider>(this VirtualCompanionBuilder builder)
            where TJsonConvertersProvider : class, IJsonConvertersProvider
        {
            builder.Services.AddTransient <IJsonConvertersProvider, TJsonConvertersProvider>();

            return(builder);
        }
        public static VirtualCompanionBuilder SetJsonSerializerSettingsProvider <TSerializerSettingsProvider>(this VirtualCompanionBuilder builder)
            where TSerializerSettingsProvider : class, IJsonSerializerSettingsProvider
        {
            builder.Services.AddTransient <IJsonSerializerSettingsProvider, TSerializerSettingsProvider>();

            return(builder);
        }
        public static VirtualCompanionBuilder SetContextSerializer <TContextSerializer>(this VirtualCompanionBuilder builder)
            where TContextSerializer : class, IVirtualCompanionExecutionContextSerializer
        {
            builder.Services.AddTransient <IVirtualCompanionExecutionContextSerializer, TContextSerializer>();

            return(builder);
        }
        public static VirtualCompanionBuilder AddHttpContextProcess <TContextProcess>(this VirtualCompanionBuilder builder, string name, Action <IHttpClientBuilder> setup = null)
            where TContextProcess : HttpVirtualCompanionExecutionContextProcessorHandlerBase
        {
            builder.AddHttp();

            var httpClientBuilder = builder.Services.AddHttpClient <IVirtualCompanionExecutionContextProcessorHandler, TContextProcess>(name);

            setup?.Invoke(httpClientBuilder);

            return(builder);
        }