public static IServiceCollection AddWebApiConventions(this IServiceCollection services) { services.ConfigureOptions<WebApiCompatShimOptionsSetup>(); // The constructors on DefaultContentNegotiator aren't DI friendly, so just // new it up. services.AddInstance<IContentNegotiator>(new DefaultContentNegotiator()); services.Configure<MvcOptions>(options => { options.ValidationExcludeFilters.Add(typeof(HttpRequestMessage)); }); return services; }
public static IServiceCollection AddBolt(this IServiceCollection services) { services.ConfigureOptions<ConfigureServerRuntimeConfiguration>(); services.AddTransient<ISerializer, JsonSerializer>(); services.AddTransient<IExceptionWrapper, JsonExceptionWrapper>(); services.AddTransient<IBoltRouteHandler, BoltRouteHandler>(); services.AddTransient<IBoltMetadataHandler, BoltMetadataHandler>(); services.AddTransient<IContractInvoker, ContractInvoker>(); services.AddTransient<IActionResolver, ActionResolver>(); services.AddTransient<IContractResolver, ContractResolver>(); services.AddTransient<IServerSessionHandler, ServerSessionHandler>(); services.AddTransient<ISessionProvider, HttpContextSessionProvider>(); services.AddTransient<IHttpSessionProvider, HttpContextSessionProvider>(); services.AddSingleton<IContractInvokerFactory, ContractInvokerFactory>(); services.AddSingleton<IServerPipelineBuilder, ServerPipelineBuilder>(); services.AddSingleton<IServerErrorHandler, ServerErrorHandler>(); return services; }