-
Notifications
You must be signed in to change notification settings - Fork 10.4k
[Blazor] Manual reflection based page discovery #49757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MackinnonBuck
merged 15 commits into
main
from
javiercn/reflection-based-component-discovery
Aug 12, 2023
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f2c7dd9
Support configuring hub options
javiercn 5761a60
tmp
javiercn 1a1ce6e
make build pass
javiercn 33ea24c
Remove unnecessary APIs
javiercn c86bd52
Remove more APIs
javiercn 7e07491
Apply API review feedback
javiercn 1334386
More feedback, fix buid, etc.
javiercn bd441b3
API updates and fixes
javiercn d81dd4b
Add WasmMinimal
javiercn 5eb13cf
Undo API change
javiercn 32f4811
Fix build
javiercn 637d7ef
Fix build
javiercn e9bf108
Merge branch 'main' into javiercn/reflection-based-component-discovery
MackinnonBuck 8987928
API changes
MackinnonBuck 39c6214
PR feedback
MackinnonBuck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/Components/Endpoints/src/Builder/RazorComponentsEndpointConventionBuilderExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Reflection; | ||
|
||
namespace Microsoft.AspNetCore.Builder; | ||
|
||
/// <summary> | ||
/// Configures which assemblies are part of the given Razor Component Application. | ||
/// </summary> | ||
public static class RazorComponentsEndpointConventionBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Adds the given additional assemblies to the component application. | ||
/// </summary> | ||
/// <param name="builder">The <see cref="RazorComponentsEndpointConventionBuilder"/>.</param>"/> | ||
/// <param name="assemblies">The <see cref="Assembly"/> instances to add.</param> | ||
/// <returns>The <see cref="RazorComponentsEndpointConventionBuilder"/>.</returns> | ||
/// <remarks> | ||
/// The provided assemblies will be scanned for pages that will be mapped as endpoints. | ||
/// </remarks> | ||
public static RazorComponentsEndpointConventionBuilder AddAdditionalAssemblies( | ||
this RazorComponentsEndpointConventionBuilder builder, | ||
params Assembly[] assemblies) | ||
{ | ||
ArgumentNullException.ThrowIfNull(builder); | ||
ArgumentNullException.ThrowIfNull(assemblies); | ||
|
||
foreach (var assembly in assemblies) | ||
{ | ||
builder.ApplicationBuilder.AddAssembly(assembly); | ||
} | ||
return builder; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
src/Components/Endpoints/src/DependencyInjection/IRazorComponentsBuilder.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't there supposed to be
AddWebAssemblyRenderMode()
directly on theRazorComponentsEndpointConventionBuilder
according to the approved API proposal at #49754?I don't think we approved any
IComponentRenderMode
APIs other thanRenderModeEndpointProvider
which we tried to hide in an Infrastructure namespace. I don't thinkRenderMode
or theIComponentRenderMode
interface itself was ever proposed as API either.I see that this is being called by an
AddWebAssemblyRenderMode
extension method inWebAssemblyRazorComponentsEndpointConventionBuilderExtensions
. I'm assuming this was done for layering reasons so we could flow options via the call toAddWebAssemblyRenderMode(WebAssemblyComponentsEndpointOptions)
.It's really odd to use different patterns for adding server and webassembly render modes. If we're going to do an extension method for one, we should do it for both. It's also a bit unusual to take an
WebAssemblyComponentsEndpointOptions
directly instead of anAction<WebAssemblyComponentsEndpointOptions>
, but maybe it's okay since we're not really doing the options pattern for endpoint config. Regardless, it's something that should be discussed in API review.