-
Notifications
You must be signed in to change notification settings - Fork 9.8k
/
ComponentEndpointConventionBuilder.cs
48 lines (43 loc) · 1.9 KB
/
ComponentEndpointConventionBuilder.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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.AspNetCore.Builder;
/// <summary>
/// Builds conventions that will be used for customization of ComponentHub <see cref="EndpointBuilder"/> instances.
/// </summary>
public sealed class ComponentEndpointConventionBuilder : IHubEndpointConventionBuilder
{
private readonly IEndpointConventionBuilder _hubEndpoint;
private readonly IEndpointConventionBuilder _disconnectEndpoint;
private readonly IEndpointConventionBuilder _jsInitializersEndpoint;
private readonly IEndpointConventionBuilder _blazorEndpoint;
internal ComponentEndpointConventionBuilder(
IEndpointConventionBuilder hubEndpoint,
IEndpointConventionBuilder disconnectEndpoint,
IEndpointConventionBuilder jsInitializersEndpoint,
IEndpointConventionBuilder blazorEndpoint)
{
_hubEndpoint = hubEndpoint;
_disconnectEndpoint = disconnectEndpoint;
_jsInitializersEndpoint = jsInitializersEndpoint;
_blazorEndpoint = blazorEndpoint;
}
/// <summary>
/// Adds the specified convention to the builder. Conventions are used to customize <see cref="EndpointBuilder"/> instances.
/// </summary>
/// <param name="convention">The convention to add to the builder.</param>
public void Add(Action<EndpointBuilder> convention)
{
_hubEndpoint.Add(convention);
_disconnectEndpoint.Add(convention);
_jsInitializersEndpoint.Add(convention);
_blazorEndpoint.Add(convention);
}
/// <inheritdoc/>
public void Finally(Action<EndpointBuilder> finalConvention)
{
_hubEndpoint.Finally(finalConvention);
_disconnectEndpoint.Finally(finalConvention);
_jsInitializersEndpoint.Finally(finalConvention);
_blazorEndpoint.Finally(finalConvention);
}
}