- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNestedControllersServiceCollectionExtensions.cs
More file actions
Latest commit
24 lines (23 loc) · 965 Bytes
/
Copy pathNestedControllersServiceCollectionExtensions.cs
File metadata and controls
24 lines (23 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
namespaceMicrosoft.Extensions.DependencyInjection;
/// <summary>
/// Extension methods for the service collection.
/// </summary>
publicstaticclassNestedControllersServiceCollectionExtensions
{
/// <summary>
/// Adds services for controllers to the specified <see cref="IServiceCollection"/>.
/// </summary>
/// <param name="services">The service collection</param>
/// <param name="includePublicNestedControllers">Whether or not to include controllers that are public and nested
/// inside another class.</param>
/// <returns>An MVC builder.</returns>
publicstaticIMvcBuilderAddControllers(thisIServiceCollectionservices,boolincludePublicNestedControllers)
{
returnservices
.AddMvc()
.ConfigureApplicationPartManager(manager =>
{
manager.FeatureProviders.Add(newNestedControllerFeatureProvider(includePublicNestedControllers));
});
}
}