-
Notifications
You must be signed in to change notification settings - Fork 0
/
Startup.cs
48 lines (43 loc) · 1.76 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
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.ContentManagement.Display.ContentDisplay;
using OrchardCore.ContentManagement.Handlers;
using OrchardCore.ContentNavigation.Drivers;
using OrchardCore.ContentNavigation.Handlers;
using OrchardCore.DisplayManagement.Descriptors;
using OrchardCore.Modules;
using OrchardCore.Navigation;
namespace OrchardCore.ContentNavigation
{
public class Startup : StartupBase {
public override void ConfigureServices(IServiceCollection services) {
services.AddNavigation();
services.AddShapeAttributes<ContentNavigationShapes>();
services.AddScoped<IContentDisplayDriver, ListPartGroupDisplayDriver>();
services.AddScoped<IContentDisplayDriver, ContainedPartDisplayDriver>();
services.AddScoped<IContentPartHandler, ListPartGroupHandler>();
services.Configure<MvcOptions>((options) =>
{
options.Filters.Add(typeof(ContentNavigationFilter));
});
}
public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
{
routes.MapAreaControllerRoute(
name: "AdminContentNavigation",
areaName: "OrchardCore.ContentNavigation",
pattern: "Admin/Contents/ContentItems/{contentItemId}/Display/{groupId}",
defaults: new { controller = "Admin", action = "Display" }
);
routes.MapAreaControllerRoute(
name: "AdminEditContentNavigation",
areaName: "OrchardCore.ContentNavigation",
pattern: "Admin/Contents/ContentItems/{contentItemId}/Edit/{groupId}",
defaults: new { controller = "Admin", action = "Edit" }
);
}
}
}