Skip to content

Commit 903c44a

Browse files
RazorComponentResult: change namespace, make executor internal, merge test classes
1 parent f5b8770 commit 903c44a

File tree

7 files changed

+444
-508
lines changed

7 files changed

+444
-508
lines changed

src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ public static IRazorComponentsBuilder AddRazorComponents(this IServiceCollection
3939

4040
services.TryAddSingleton<RazorComponentsMarkerService>();
4141

42-
// Results
43-
services.TryAddSingleton<RazorComponentResultExecutor>();
44-
4542
// Endpoints
4643
services.TryAddSingleton<RazorComponentEndpointDataSourceFactory>();
4744
services.TryAddSingleton<RazorComponentEndpointFactory>();

src/Components/Endpoints/src/PublicAPI.Unshipped.txt

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,6 @@ Microsoft.AspNetCore.Components.Endpoints.Infrastructure.RenderModeEndpointProvi
1818
Microsoft.AspNetCore.Components.Endpoints.Infrastructure.RenderModeEndpointProvider.RenderModeEndpointProvider() -> void
1919
Microsoft.AspNetCore.Components.Endpoints.IRazorComponentEndpointInvoker
2020
Microsoft.AspNetCore.Components.Endpoints.IRazorComponentEndpointInvoker.Render(Microsoft.AspNetCore.Http.HttpContext! context) -> System.Threading.Tasks.Task!
21-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult
22-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.ComponentType.get -> System.Type!
23-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.ContentType.get -> string?
24-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.ContentType.set -> void
25-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.ExecuteAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task!
26-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.Parameters.get -> System.Collections.Generic.IReadOnlyDictionary<string!, object?>!
27-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.PreventStreamingRendering.get -> bool
28-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.PreventStreamingRendering.set -> void
29-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.RazorComponentResult(System.Type! componentType) -> void
30-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.RazorComponentResult(System.Type! componentType, object? parameters) -> void
31-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.RazorComponentResult(System.Type! componentType, System.Collections.Generic.IReadOnlyDictionary<string!, object?>? parameters) -> void
32-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.StatusCode.get -> int?
33-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.StatusCode.set -> void
34-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult<TComponent>
35-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult<TComponent>.RazorComponentResult() -> void
36-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult<TComponent>.RazorComponentResult(object! parameters) -> void
37-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult<TComponent>.RazorComponentResult(System.Collections.Generic.IReadOnlyDictionary<string!, object?>! parameters) -> void
38-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResultExecutor
39-
Microsoft.AspNetCore.Components.Endpoints.RazorComponentResultExecutor.RazorComponentResultExecutor() -> void
4021
Microsoft.AspNetCore.Components.Endpoints.RazorComponentsOptions
4122
Microsoft.AspNetCore.Components.Endpoints.RazorComponentsOptions.MaxFormMappingCollectionSize.get -> int
4223
Microsoft.AspNetCore.Components.Endpoints.RazorComponentsOptions.MaxFormMappingCollectionSize.set -> void
@@ -54,11 +35,26 @@ Microsoft.AspNetCore.Components.PersistedStateSerializationMode
5435
Microsoft.AspNetCore.Components.PersistedStateSerializationMode.Infer = 1 -> Microsoft.AspNetCore.Components.PersistedStateSerializationMode
5536
Microsoft.AspNetCore.Components.PersistedStateSerializationMode.Server = 2 -> Microsoft.AspNetCore.Components.PersistedStateSerializationMode
5637
Microsoft.AspNetCore.Components.PersistedStateSerializationMode.WebAssembly = 3 -> Microsoft.AspNetCore.Components.PersistedStateSerializationMode
38+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult
39+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.ComponentType.get -> System.Type!
40+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.ContentType.get -> string?
41+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.ContentType.set -> void
42+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.ExecuteAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task!
43+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.Parameters.get -> System.Collections.Generic.IReadOnlyDictionary<string!, object?>!
44+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.PreventStreamingRendering.get -> bool
45+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.PreventStreamingRendering.set -> void
46+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.RazorComponentResult(System.Type! componentType) -> void
47+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.RazorComponentResult(System.Type! componentType, object? parameters) -> void
48+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.RazorComponentResult(System.Type! componentType, System.Collections.Generic.IReadOnlyDictionary<string!, object?>? parameters) -> void
49+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.StatusCode.get -> int?
50+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.StatusCode.set -> void
51+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult<TComponent>
52+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult<TComponent>.RazorComponentResult() -> void
53+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult<TComponent>.RazorComponentResult(object! parameters) -> void
54+
Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult<TComponent>.RazorComponentResult(System.Collections.Generic.IReadOnlyDictionary<string!, object?>! parameters) -> void
5755
Microsoft.Extensions.DependencyInjection.IRazorComponentsBuilder
5856
Microsoft.Extensions.DependencyInjection.IRazorComponentsBuilder.Services.get -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
5957
Microsoft.Extensions.DependencyInjection.RazorComponentsServiceCollectionExtensions
6058
static Microsoft.AspNetCore.Builder.RazorComponentsEndpointConventionBuilderExtensions.AddAdditionalAssemblies(this Microsoft.AspNetCore.Builder.RazorComponentsEndpointConventionBuilder! builder, params System.Reflection.Assembly![]! assemblies) -> Microsoft.AspNetCore.Builder.RazorComponentsEndpointConventionBuilder!
6159
static Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents<TRootComponent>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder! endpoints) -> Microsoft.AspNetCore.Builder.RazorComponentsEndpointConventionBuilder!
6260
static Microsoft.Extensions.DependencyInjection.RazorComponentsServiceCollectionExtensions.AddRazorComponents(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action<Microsoft.AspNetCore.Components.Endpoints.RazorComponentsOptions!>? configure = null) -> Microsoft.Extensions.DependencyInjection.IRazorComponentsBuilder!
63-
static readonly Microsoft.AspNetCore.Components.Endpoints.RazorComponentResultExecutor.DefaultContentType -> string!
64-
virtual Microsoft.AspNetCore.Components.Endpoints.RazorComponentResultExecutor.ExecuteAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext, Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult! result) -> System.Threading.Tasks.Task!

src/Components/Endpoints/src/Results/RazorComponentResult.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Diagnostics.CodeAnalysis;
5-
using Microsoft.AspNetCore.Http;
6-
using Microsoft.Extensions.DependencyInjection;
5+
using Microsoft.AspNetCore.Components;
6+
using Microsoft.AspNetCore.Components.Endpoints;
77
using Microsoft.Extensions.Internal;
88
using static Microsoft.AspNetCore.Internal.LinkerFlags;
99

10-
namespace Microsoft.AspNetCore.Components.Endpoints;
10+
namespace Microsoft.AspNetCore.Http.HttpResults;
1111

1212
/// <summary>
1313
/// An <see cref="IResult"/> that renders a Razor Component.
@@ -87,15 +87,10 @@ public RazorComponentResult([DynamicallyAccessedMembers(Component)] Type compone
8787
public bool PreventStreamingRendering { get; set; }
8888

8989
/// <summary>
90-
/// Requests the service of
91-
/// <see cref="RazorComponentResultExecutor.ExecuteAsync(HttpContext, RazorComponentResult)" />
92-
/// to process itself in the given <paramref name="httpContext" />.
90+
/// Processes this result in the given <paramref name="httpContext" />.
9391
/// </summary>
9492
/// <param name="httpContext">An <see cref="HttpContext" /> associated with the current request.</param >
9593
/// <returns >A <see cref="T:System.Threading.Tasks.Task" /> which will complete when execution is completed.</returns >
9694
public Task ExecuteAsync(HttpContext httpContext)
97-
{
98-
var executor = httpContext.RequestServices.GetRequiredService<RazorComponentResultExecutor>();
99-
return executor.ExecuteAsync(httpContext, this);
100-
}
95+
=> RazorComponentResultExecutor.ExecuteAsync(httpContext, this);
10196
}

src/Components/Endpoints/src/Results/RazorComponentResultExecutor.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,15 @@
99
using Microsoft.AspNetCore.WebUtilities;
1010
using Microsoft.Extensions.DependencyInjection;
1111
using static Microsoft.AspNetCore.Internal.LinkerFlags;
12+
using Microsoft.AspNetCore.Http.HttpResults;
1213

1314
namespace Microsoft.AspNetCore.Components.Endpoints;
1415

15-
/// <summary>
16-
/// Executes a <see cref="RazorComponentResult"/>.
17-
/// </summary>
18-
public class RazorComponentResultExecutor
16+
internal static class RazorComponentResultExecutor
1917
{
20-
/// <summary>
21-
/// The default content-type header value for Razor Components, <c>text/html; charset=utf-8</c>.
22-
/// </summary>
23-
public static readonly string DefaultContentType = "text/html; charset=utf-8";
18+
public const string DefaultContentType = "text/html; charset=utf-8";
2419

25-
/// <summary>
26-
/// Executes a <see cref="RazorComponentResult"/> asynchronously.
27-
/// </summary>
28-
public virtual Task ExecuteAsync(HttpContext httpContext, RazorComponentResult result)
20+
public static Task ExecuteAsync(HttpContext httpContext, RazorComponentResult result)
2921
{
3022
ArgumentNullException.ThrowIfNull(httpContext);
3123

@@ -44,7 +36,7 @@ public virtual Task ExecuteAsync(HttpContext httpContext, RazorComponentResult r
4436
result.PreventStreamingRendering);
4537
}
4638

47-
internal static Task RenderComponentToResponse(
39+
private static Task RenderComponentToResponse(
4840
HttpContext httpContext,
4941
[DynamicallyAccessedMembers(Component)] Type componentType,
5042
IReadOnlyDictionary<string, object?>? componentParameters,

src/Components/Endpoints/src/Results/RazorComponentResultOfT.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Diagnostics.CodeAnalysis;
5-
using Microsoft.AspNetCore.Http;
5+
using Microsoft.AspNetCore.Components;
66
using static Microsoft.AspNetCore.Internal.LinkerFlags;
77

8-
namespace Microsoft.AspNetCore.Components.Endpoints;
8+
namespace Microsoft.AspNetCore.Http.HttpResults;
99

1010
/// <summary>
1111
/// An <see cref="IResult"/> that renders a Razor Component.
1212
/// </summary>
13-
public class RazorComponentResult<[DynamicallyAccessedMembers(Component)] TComponent> : RazorComponentResult where TComponent: IComponent
13+
public class RazorComponentResult<[DynamicallyAccessedMembers(Component)] TComponent>
14+
: RazorComponentResult where TComponent: IComponent
1415
{
1516
/// <summary>
1617
/// Constructs an instance of <see cref="RazorComponentResult"/>.

0 commit comments

Comments
 (0)