Skip to content

Commit 69f0330

Browse files
authored
Add an application part factory for an assembly that contains controllers and views. (#30481)
1 parent 7bbaec1 commit 69f0330

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Reflection;
7+
8+
namespace Microsoft.AspNetCore.Mvc.ApplicationParts
9+
{
10+
/// <summary>
11+
/// Configures an <see cref="ApplicationPart" /> that contains controllers, as well as Razor views and Pages.
12+
/// <para>
13+
/// Combines the results of <see cref="DefaultApplicationPartFactory.GetApplicationParts(Assembly)"/> and
14+
/// <see cref="CompiledRazorAssemblyApplicationPartFactory.GetApplicationParts(Assembly)"/>. This part factory
15+
/// may be used if Razor views or Razor Pages are compiled in to with other types including controllers.
16+
/// </para>
17+
/// </summary>
18+
public sealed class ConsolidatedAssemblyApplicationPartFactory : ApplicationPartFactory
19+
{
20+
/// <inheritdoc />
21+
public override IEnumerable<ApplicationPart> GetApplicationParts(Assembly assembly)
22+
{
23+
return Enumerable.Concat(
24+
DefaultApplicationPartFactory.GetDefaultApplicationParts(assembly),
25+
CompiledRazorAssemblyApplicationPartFactory.GetDefaultApplicationParts(assembly));
26+
}
27+
}
28+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
#nullable enable
2+
Microsoft.AspNetCore.Mvc.ApplicationParts.ConsolidatedAssemblyApplicationPartFactory
3+
Microsoft.AspNetCore.Mvc.ApplicationParts.ConsolidatedAssemblyApplicationPartFactory.ConsolidatedAssemblyApplicationPartFactory() -> void
4+
~override Microsoft.AspNetCore.Mvc.ApplicationParts.ConsolidatedAssemblyApplicationPartFactory.GetApplicationParts(System.Reflection.Assembly assembly) -> System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPart>

0 commit comments

Comments
 (0)