From e62edc7bef567b99f939b08994b165fb04e30d3a Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 23 Dec 2020 12:02:23 +1100 Subject: [PATCH] missing file --- .../UmbracoBuilderExtensions.cs | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/Umbraco.Web.Website/DependencyInjection/UmbracoBuilderExtensions.cs diff --git a/src/Umbraco.Web.Website/DependencyInjection/UmbracoBuilderExtensions.cs b/src/Umbraco.Web.Website/DependencyInjection/UmbracoBuilderExtensions.cs new file mode 100644 index 0000000000..6f34ca6136 --- /dev/null +++ b/src/Umbraco.Web.Website/DependencyInjection/UmbracoBuilderExtensions.cs @@ -0,0 +1,44 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Umbraco.Core.DependencyInjection; +using Umbraco.Infrastructure.PublishedCache.Extensions; +using Umbraco.Web.Website.Controllers; +using Umbraco.Web.Website.Routing; +using Umbraco.Web.Website.ViewEngines; + +namespace Umbraco.Web.Website.DependencyInjection +{ + /// + /// extensions for umbraco front-end website + /// + public static partial class UmbracoBuilderExtensions + { + /// + /// Add services for the umbraco front-end website + /// + public static IUmbracoBuilder AddWebsite(this IUmbracoBuilder builder) + { + // Set the render & plugin view engines (Super complicated, but this allows us to use the IServiceCollection + // to inject dependencies into the viewEngines) + builder.Services.AddTransient, RenderMvcViewOptionsSetup>(); + builder.Services.AddSingleton(); + builder.Services.AddTransient, PluginMvcViewOptionsSetup>(); + builder.Services.AddSingleton(); + + // Wraps all existing view engines in a ProfilerViewEngine + builder.Services.AddTransient, ProfilingViewEngineWrapperMvcViewOptionsSetup>(); + + // TODO figure out if we need more to work on load balanced setups + builder.Services.AddDataProtection(); + + builder.Services.AddScoped(); + builder.Services.AddSingleton(); + + builder.AddNuCache(); + + return builder; + } + + } +}