|
1 | | -namespace TestSite.Ten |
| 1 | +namespace TestSite.Ten; |
| 2 | + |
| 3 | +public class Startup |
2 | 4 | { |
3 | | - public class Startup |
| 5 | + private readonly IConfiguration _config; |
| 6 | + private readonly IWebHostEnvironment _env; |
| 7 | + |
| 8 | + /// <summary> |
| 9 | + /// Initializes a new instance of the <see cref="Startup" /> class. |
| 10 | + /// </summary> |
| 11 | + /// <param name="webHostEnvironment">The web hosting environment.</param> |
| 12 | + /// <param name="config">The configuration.</param> |
| 13 | + /// <remarks> |
| 14 | + /// Only a few services are possible to be injected here https://github.com/dotnet/aspnetcore/issues/9337. |
| 15 | + /// </remarks> |
| 16 | + public Startup(IWebHostEnvironment webHostEnvironment, IConfiguration config) |
4 | 17 | { |
5 | | - private readonly IWebHostEnvironment _env; |
6 | | - private readonly IConfiguration _config; |
| 18 | + _env = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment)); |
| 19 | + _config = config ?? throw new ArgumentNullException(nameof(config)); |
| 20 | + } |
7 | 21 |
|
8 | | - /// <summary> |
9 | | - /// Initializes a new instance of the <see cref="Startup" /> class. |
10 | | - /// </summary> |
11 | | - /// <param name="webHostEnvironment">The web hosting environment.</param> |
12 | | - /// <param name="config">The configuration.</param> |
13 | | - /// <remarks> |
14 | | - /// Only a few services are possible to be injected here https://github.com/dotnet/aspnetcore/issues/9337. |
15 | | - /// </remarks> |
16 | | - public Startup(IWebHostEnvironment webHostEnvironment, IConfiguration config) |
17 | | - { |
18 | | - _env = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment)); |
19 | | - _config = config ?? throw new ArgumentNullException(nameof(config)); |
20 | | - } |
| 22 | + /// <summary> |
| 23 | + /// Configures the services. |
| 24 | + /// </summary> |
| 25 | + /// <param name="services">The services.</param> |
| 26 | + /// <remarks> |
| 27 | + /// This method gets called by the runtime. Use this method to add services to the container. |
| 28 | + /// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940. |
| 29 | + /// </remarks> |
| 30 | + public void ConfigureServices(IServiceCollection services) |
| 31 | + { |
| 32 | + services.AddUmbraco(_env, _config) |
| 33 | + .AddBackOffice() |
| 34 | + .AddWebsite() |
| 35 | + .AddComposers() |
| 36 | + .Build(); |
| 37 | + } |
21 | 38 |
|
22 | | - /// <summary> |
23 | | - /// Configures the services. |
24 | | - /// </summary> |
25 | | - /// <param name="services">The services.</param> |
26 | | - /// <remarks> |
27 | | - /// This method gets called by the runtime. Use this method to add services to the container. |
28 | | - /// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940. |
29 | | - /// </remarks> |
30 | | - public void ConfigureServices(IServiceCollection services) |
| 39 | + /// <summary> |
| 40 | + /// Configures the application. |
| 41 | + /// </summary> |
| 42 | + /// <param name="app">The application builder.</param> |
| 43 | + /// <param name="env">The web hosting environment.</param> |
| 44 | + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
| 45 | + { |
| 46 | + if (env.IsDevelopment()) |
31 | 47 | { |
32 | | - services.AddUmbraco(_env, _config) |
33 | | - .AddBackOffice() |
34 | | - .AddWebsite() |
35 | | - .AddComposers() |
36 | | - .Build(); |
| 48 | + app.UseDeveloperExceptionPage(); |
37 | 49 | } |
38 | 50 |
|
39 | | - /// <summary> |
40 | | - /// Configures the application. |
41 | | - /// </summary> |
42 | | - /// <param name="app">The application builder.</param> |
43 | | - /// <param name="env">The web hosting environment.</param> |
44 | | - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
45 | | - { |
46 | | - if (env.IsDevelopment()) |
| 51 | + app.UseUmbraco() |
| 52 | + .WithMiddleware(u => |
47 | 53 | { |
48 | | - app.UseDeveloperExceptionPage(); |
49 | | - } |
50 | | - |
51 | | - app.UseUmbraco() |
52 | | - .WithMiddleware(u => |
53 | | - { |
54 | | - u.UseBackOffice(); |
55 | | - u.UseWebsite(); |
56 | | - }) |
57 | | - .WithEndpoints(u => |
58 | | - { |
59 | | - u.UseInstallerEndpoints(); |
60 | | - u.UseBackOfficeEndpoints(); |
61 | | - u.UseWebsiteEndpoints(); |
62 | | - }); |
63 | | - } |
| 54 | + u.UseBackOffice(); |
| 55 | + u.UseWebsite(); |
| 56 | + }) |
| 57 | + .WithEndpoints(u => |
| 58 | + { |
| 59 | + u.UseInstallerEndpoints(); |
| 60 | + u.UseBackOfficeEndpoints(); |
| 61 | + u.UseWebsiteEndpoints(); |
| 62 | + }); |
64 | 63 | } |
65 | 64 | } |
0 commit comments