2020-02-18 08:32:06 +01:00
|
|
|
using System;
|
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
2020-03-16 14:02:08 +01:00
|
|
|
using Microsoft.Extensions.Configuration;
|
2020-02-18 08:32:06 +01:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Hosting;
|
2020-05-07 10:08:23 +02:00
|
|
|
using Umbraco.Extensions;
|
2020-09-02 18:10:29 +10:00
|
|
|
using Umbraco.Web.Common.Builder;
|
2020-02-18 08:32:06 +01:00
|
|
|
|
2020-08-11 08:28:16 +02:00
|
|
|
namespace Umbraco.Web.UI.NetCore
|
2020-02-18 08:32:06 +01:00
|
|
|
{
|
|
|
|
|
public class Startup
|
|
|
|
|
{
|
2020-04-03 01:08:52 +11:00
|
|
|
private readonly IWebHostEnvironment _env;
|
2020-03-25 18:21:44 +11:00
|
|
|
private readonly IConfiguration _config;
|
2020-03-25 20:42:02 +01:00
|
|
|
|
2020-03-25 18:21:44 +11:00
|
|
|
/// <summary>
|
|
|
|
|
/// Constructor
|
|
|
|
|
/// </summary>
|
2020-08-24 14:23:08 +02:00
|
|
|
/// <param name="webHostEnvironment">The Web Host Environment</param>
|
|
|
|
|
/// <param name="config">The Configuration</param>
|
2020-03-25 18:21:44 +11:00
|
|
|
/// <remarks>
|
|
|
|
|
/// Only a few services are possible to be injected here https://github.com/dotnet/aspnetcore/issues/9337
|
|
|
|
|
/// </remarks>
|
|
|
|
|
public Startup(IWebHostEnvironment webHostEnvironment, IConfiguration config)
|
2020-03-25 20:42:02 +01:00
|
|
|
{
|
2020-04-03 01:08:52 +11:00
|
|
|
_env = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment));
|
2020-03-25 18:21:44 +11:00
|
|
|
_config = config ?? throw new ArgumentNullException(nameof(config));
|
2020-03-25 20:42:02 +01:00
|
|
|
}
|
|
|
|
|
|
2020-02-18 08:32:06 +01:00
|
|
|
// This method gets called by the runtime. Use this method to add services to the container.
|
|
|
|
|
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
|
|
|
|
public void ConfigureServices(IServiceCollection services)
|
2020-05-15 15:21:15 +01:00
|
|
|
{
|
2020-09-02 18:10:29 +10:00
|
|
|
var umbracoBuilder = services.AddUmbraco(_env, _config);
|
2020-10-22 12:23:32 +02:00
|
|
|
umbracoBuilder
|
|
|
|
|
.WithAllBackOfficeComponents()
|
|
|
|
|
.WithAllWebsiteComponents()
|
|
|
|
|
.Build();
|
2020-09-07 15:28:58 +02:00
|
|
|
|
2020-02-18 08:32:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
2020-04-03 01:08:52 +11:00
|
|
|
public void Configure(IApplicationBuilder app)
|
2020-02-18 08:32:06 +01:00
|
|
|
{
|
2020-04-03 01:08:52 +11:00
|
|
|
if (_env.IsDevelopment())
|
2020-02-18 08:32:06 +01:00
|
|
|
{
|
|
|
|
|
app.UseDeveloperExceptionPage();
|
|
|
|
|
}
|
2020-05-12 10:21:40 +10:00
|
|
|
|
2020-08-24 14:23:08 +02:00
|
|
|
app.UseUmbraco();
|
2020-02-18 08:32:06 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|