-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStartup.cs
More file actions
83 lines (77 loc) · 2.87 KB
/
Startup.cs
File metadata and controls
83 lines (77 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// =================================================================================================================================
// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
// =================================================================================================================================
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using RapidField.SolidInstruments.InversionOfControl.DotNetNative.Extensions;
using System;
namespace RapidField.SolidInstruments.Example.WebApplication
{
/// <summary>
/// Houses application configuration information and mechanics.
/// </summary>
public class Startup
{
/// <summary>
/// Initializes a new instance of the <see cref="Startup" /> class.
/// </summary>
/// <param name="configuration">
/// Configuration information for the application.
/// </param>
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
/// <summary>
/// Configures the application prior to startup.
/// </summary>
/// <param name="app">
/// An object that configures the application's request pipeline.
/// </param>
/// <param name="env">
/// Information about the application's hosting environment.
/// </param>
public static void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseStaticFiles();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapRazorPages();
});
}
/// <summary>
/// Configures dependencies for the application.
/// </summary>
/// <param name="services">
/// A collection of service descriptors to which dependencies are added.
/// </param>
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddDependencyPackage<ApplicationDependencyPackage>(Configuration, out var serviceProvider);
services.AddControllers();
services.AddRazorPages();
return serviceProvider;
}
/// <summary>
/// Gets configuration information for the application.
/// </summary>
public IConfiguration Configuration
{
get;
}
}
}