-
Notifications
You must be signed in to change notification settings - Fork 747
/
Startup.cs
70 lines (64 loc) · 2.32 KB
/
Startup.cs
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
// -----------------------------------------------------------------------
// <copyright file="Startup.cs" company="OSharp开源团队">
// Copyright (c) 2014-2022 OSharp. All rights reserved.
// </copyright>
// <site>http://www.osharp.org</site>
// <last-editor>郭明锋</last-editor>
// <last-date>2022-11-10 13:46</last-date>
// -----------------------------------------------------------------------
using Liuliu.Demo.Web.Startups;
using OSharp.AspNetCore.Routing;
using OSharp.AutoMapper;
using OSharp.Hangfire;
using OSharp.Hosting.Authorization;
using OSharp.Hosting.Identity;
using OSharp.Hosting.Infos;
using OSharp.Hosting.Systems;
using OSharp.Log4Net;
using OSharp.MiniProfiler;
using OSharp.Redis;
using OSharp.Swagger;
namespace Liuliu.Demo.Web
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddDatabaseDeveloperPageExceptionFilter();
services.AddOSharp()
.AddPack<Log4NetPack>()
.AddPack<AutoMapperPack>()
.AddPack<EndpointsPack>()
.AddPack<MiniProfilerPack>()
.AddPack<SwaggerPack>()
.AddPack<RedisPack>()
.AddPack<SystemsPack>()
.AddPack<AuthenticationPack>()
.AddPack<FunctionAuthorizationPack>()
.AddPack<DataAuthorizationPack>()
.AddPack<SqlServerDefaultDbContextMigrationPack>()
//.AddPack<HangfirePack>()
.AddPack<AuditPack>()
.AddPack<InfosPack>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(WebApplication app)
{
IWebHostEnvironment env = app.Environment;
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseMigrationsEndPoint();
}
else
{
app.UseHttpsRedirection();
}
app //.UseMiddleware<JsonExceptionHandlerMiddleware>()
.UseDefaultFiles()
.UseStaticFiles();
app.UseOSharp();
}
}
}