Skip to content

Exposes the underlying HttpConnectionDispatcherOptions in MapBlazorHub #10690

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
merged 4 commits into from
May 31, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ public static partial class ComponentEndpointConventionBuilderExtensions
public static partial class ComponentEndpointRouteBuilderExtensions
{
public static Microsoft.AspNetCore.Components.Server.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints) { throw null; }
public static Microsoft.AspNetCore.Components.Server.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, System.Action<Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) { throw null; }
public static Microsoft.AspNetCore.Components.Server.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, System.Type type, string selector) { throw null; }
public static Microsoft.AspNetCore.Components.Server.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, System.Type type, string selector, System.Action<Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) { throw null; }
public static Microsoft.AspNetCore.Components.Server.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, System.Type componentType, string selector, string path) { throw null; }
public static Microsoft.AspNetCore.Components.Server.ComponentEndpointConventionBuilder MapBlazorHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, System.Type componentType, string selector, string path, System.Action<Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) { throw null; }
public static Microsoft.AspNetCore.Components.Server.ComponentEndpointConventionBuilder MapBlazorHub<TComponent>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string selector) where TComponent : Microsoft.AspNetCore.Components.IComponent { throw null; }
public static Microsoft.AspNetCore.Components.Server.ComponentEndpointConventionBuilder MapBlazorHub<TComponent>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string selector, System.Action<Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) where TComponent : Microsoft.AspNetCore.Components.IComponent { throw null; }
public static Microsoft.AspNetCore.Components.Server.ComponentEndpointConventionBuilder MapBlazorHub<TComponent>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string selector, string path) where TComponent : Microsoft.AspNetCore.Components.IComponent { throw null; }
public static Microsoft.AspNetCore.Components.Server.ComponentEndpointConventionBuilder MapBlazorHub<TComponent>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string selector, string path, System.Action<Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) where TComponent : Microsoft.AspNetCore.Components.IComponent { throw null; }
}
}
namespace Microsoft.AspNetCore.Components.Browser.Rendering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
using System;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Server;
using Microsoft.AspNetCore.Http.Connections;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.SignalR;

namespace Microsoft.AspNetCore.Builder
{
Expand All @@ -14,7 +16,7 @@ namespace Microsoft.AspNetCore.Builder
public static class ComponentEndpointRouteBuilderExtensions
{
/// <summary>
/// Maps the SignalR <see cref="ComponentHub"/> to the path <see cref="ComponentHub.DefaultPath"/>.
/// Maps the Blazor <see cref="Hub" /> to the default path.
/// </summary>
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/>.</param>
/// <returns>The <see cref="ComponentEndpointConventionBuilder"/>.</returns>
Expand All @@ -29,16 +31,37 @@ public static ComponentEndpointConventionBuilder MapBlazorHub(this IEndpointRout
}

/// <summary>
/// Maps the SignalR <see cref="ComponentHub"/> to the path <see cref="ComponentHub.DefaultPath"/> and associates
/// Maps the Blazor <see cref="Hub" /> to the default path.
/// </summary>
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/>.</param>
/// <param name="configureOptions">A callback to configure dispatcher options.</param>
/// <returns>The <see cref="ComponentEndpointConventionBuilder"/>.</returns>
public static ComponentEndpointConventionBuilder MapBlazorHub(this IEndpointRouteBuilder endpoints, Action<HttpConnectionDispatcherOptions> configureOptions)
{
if (endpoints == null)
{
throw new ArgumentNullException(nameof(endpoints));
}

if (configureOptions == null)
{
throw new ArgumentNullException(nameof(configureOptions));
}

return new ComponentEndpointConventionBuilder(endpoints.MapHub<ComponentHub>(ComponentHub.DefaultPath, configureOptions));
}

/// <summary>
///Maps the Blazor <see cref="Hub" /> to the default path and associates
/// the component <typeparamref name="TComponent"/> to this hub instance as the given DOM <paramref name="selector"/>.
/// </summary>
/// <typeparam name="TComponent">The first <see cref="IComponent"/> associated with this <see cref="ComponentHub"/>.</typeparam>
/// <typeparam name="TComponent">The first <see cref="IComponent"/> associated with this Blazor <see cref="Hub" />.</typeparam>
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/>.</param>
/// <param name="selector">The selector for the <typeparamref name="TComponent"/>.</param>
/// <returns>The <see cref="ComponentEndpointConventionBuilder"/>.</returns>
public static ComponentEndpointConventionBuilder MapBlazorHub<TComponent>(
this IEndpointRouteBuilder endpoints,
string selector) where TComponent: IComponent
string selector) where TComponent : IComponent
{
if (endpoints == null)
{
Expand All @@ -54,11 +77,43 @@ public static ComponentEndpointConventionBuilder MapBlazorHub<TComponent>(
}

/// <summary>
/// Maps the SignalR <see cref="ComponentHub"/> to the path <see cref="ComponentHub.DefaultPath"/> and associates
///Maps the Blazor <see cref="Hub" /> to the default path and associates
/// the component <typeparamref name="TComponent"/> to this hub instance as the given DOM <paramref name="selector"/>.
/// </summary>
/// <typeparam name="TComponent">The first <see cref="IComponent"/> associated with this Blazor <see cref="Hub" />.</typeparam>
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/>.</param>
/// <param name="selector">The selector for the <typeparamref name="TComponent"/>.</param>
/// <param name="configureOptions">A callback to configure dispatcher options.</param>
/// <returns>The <see cref="ComponentEndpointConventionBuilder"/>.</returns>
public static ComponentEndpointConventionBuilder MapBlazorHub<TComponent>(
this IEndpointRouteBuilder endpoints,
string selector,
Action<HttpConnectionDispatcherOptions> configureOptions) where TComponent : IComponent
{
if (endpoints == null)
{
throw new ArgumentNullException(nameof(endpoints));
}

if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}

if (configureOptions == null)
{
throw new ArgumentNullException(nameof(configureOptions));
}

return endpoints.MapBlazorHub(typeof(TComponent), selector, ComponentHub.DefaultPath, configureOptions);
}

/// <summary>
///Maps the Blazor <see cref="Hub" /> to the default path and associates
/// the component <paramref name="type"/> to this hub instance as the given DOM <paramref name="selector"/>.
/// </summary>
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/>.</param>
/// <param name="type">The first <see cref="IComponent"/> associated with this <see cref="ComponentHub"/>.</param>
/// <param name="type">The first <see cref="IComponent"/> associated with this Blazor <see cref="Hub" />.</param>
/// <param name="selector">The selector for the component.</param>
/// <returns>The <see cref="ComponentEndpointConventionBuilder"/>.</returns>
public static ComponentEndpointConventionBuilder MapBlazorHub(
Expand All @@ -85,13 +140,51 @@ public static ComponentEndpointConventionBuilder MapBlazorHub(
}

/// <summary>
/// Maps the SignalR <see cref="ComponentHub"/> to the path <paramref name="path"/> and associates
///Maps the Blazor <see cref="Hub" /> to the default path and associates
/// the component <paramref name="type"/> to this hub instance as the given DOM <paramref name="selector"/>.
/// </summary>
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/>.</param>
/// <param name="type">The first <see cref="IComponent"/> associated with this Blazor <see cref="Hub" />.</param>
/// <param name="selector">The selector for the component.</param>
/// <param name="configureOptions">A callback to configure dispatcher options.</param>
/// <returns>The <see cref="ComponentEndpointConventionBuilder"/>.</returns>
public static ComponentEndpointConventionBuilder MapBlazorHub(
this IEndpointRouteBuilder endpoints,
Type type,
string selector,
Action<HttpConnectionDispatcherOptions> configureOptions)
{
if (endpoints == null)
{
throw new ArgumentNullException(nameof(endpoints));
}

if (type == null)
{
throw new ArgumentNullException(nameof(type));
}

if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}

if (configureOptions == null)
{
throw new ArgumentNullException(nameof(configureOptions));
}

return endpoints.MapBlazorHub(type, selector, ComponentHub.DefaultPath, configureOptions);
}

/// <summary>
/// Maps the Blazor <see cref="Hub" /> to the path <paramref name="path"/> and associates
/// the component <typeparamref name="TComponent"/> to this hub instance as the given DOM <paramref name="selector"/>.
/// </summary>
/// <typeparam name="TComponent">The first <see cref="IComponent"/> associated with this <see cref="ComponentHub"/>.</typeparam>
/// <typeparam name="TComponent">The first <see cref="IComponent"/> associated with this Blazor <see cref="Hub" />.</typeparam>
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/>.</param>
/// <param name="selector">The selector for the <typeparamref name="TComponent"/>.</param>
/// <param name="path">The path to map to which the <see cref="ComponentHub"/> will be mapped.</param>
/// <param name="path">The path to map the Blazor <see cref="Hub" />.</param>
/// <returns>The <see cref="ComponentEndpointConventionBuilder"/>.</returns>
public static ComponentEndpointConventionBuilder MapBlazorHub<TComponent>(
this IEndpointRouteBuilder endpoints,
Expand All @@ -117,13 +210,52 @@ public static ComponentEndpointConventionBuilder MapBlazorHub<TComponent>(
}

/// <summary>
/// Maps the SignalR <see cref="ComponentHub"/> to the path <paramref name="path"/> and associates
/// Maps the Blazor <see cref="Hub" /> to the path <paramref name="path"/> and associates
/// the component <typeparamref name="TComponent"/> to this hub instance as the given DOM <paramref name="selector"/>.
/// </summary>
/// <typeparam name="TComponent">The first <see cref="IComponent"/> associated with this Blazor <see cref="Hub" />.</typeparam>
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/>.</param>
/// <param name="selector">The selector for the <typeparamref name="TComponent"/>.</param>
/// <param name="path">The path to map the Blazor <see cref="Hub" />.</param>
/// <param name="configureOptions">A callback to configure dispatcher options.</param>
/// <returns>The <see cref="ComponentEndpointConventionBuilder"/>.</returns>
public static ComponentEndpointConventionBuilder MapBlazorHub<TComponent>(
this IEndpointRouteBuilder endpoints,
string selector,
string path,
Action<HttpConnectionDispatcherOptions> configureOptions) where TComponent : IComponent
{
if (endpoints == null)
{
throw new ArgumentNullException(nameof(endpoints));
}

if (path == null)
{
throw new ArgumentNullException(nameof(path));
}

if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}

if (configureOptions == null)
{
throw new ArgumentNullException(nameof(configureOptions));
}

return endpoints.MapBlazorHub(typeof(TComponent), selector, path, configureOptions);
}

/// <summary>
/// Maps the Blazor <see cref="Hub" /> to the path <paramref name="path"/> and associates
/// the component <paramref name="componentType"/> to this hub instance as the given DOM <paramref name="selector"/>.
/// </summary>
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/>.</param>
/// <param name="componentType">The first <see cref="IComponent"/> associated with this <see cref="ComponentHub"/>.</param>
/// <param name="componentType">The first <see cref="IComponent"/> associated with this Blazor <see cref="Hub" />.</param>
/// <param name="selector">The selector for the <paramref name="componentType"/>.</param>
/// <param name="path">The path to map to which the <see cref="ComponentHub"/> will be mapped.</param>
/// <param name="path">The path to map the Blazor <see cref="Hub" />.</param>
/// <returns>The <see cref="ComponentEndpointConventionBuilder"/>.</returns>
public static ComponentEndpointConventionBuilder MapBlazorHub(
this IEndpointRouteBuilder endpoints,
Expand Down Expand Up @@ -153,5 +285,50 @@ public static ComponentEndpointConventionBuilder MapBlazorHub(

return new ComponentEndpointConventionBuilder(endpoints.MapHub<ComponentHub>(path)).AddComponent(componentType, selector);
}

/// <summary>
/// Maps the Blazor <see cref="Hub" /> to the path <paramref name="path"/> and associates
/// the component <paramref name="componentType"/> to this hub instance as the given DOM <paramref name="selector"/>.
/// </summary>
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/>.</param>
/// <param name="componentType">The first <see cref="IComponent"/> associated with this Blazor <see cref="Hub" />.</param>
/// <param name="selector">The selector for the <paramref name="componentType"/>.</param>
/// <param name="configureOptions">A callback to configure dispatcher options.</param>
/// <param name="path">The path to map the Blazor <see cref="Hub" />.</param>
/// <returns>The <see cref="ComponentEndpointConventionBuilder"/>.</returns>
public static ComponentEndpointConventionBuilder MapBlazorHub(
this IEndpointRouteBuilder endpoints,
Type componentType,
string selector,
string path,
Action<HttpConnectionDispatcherOptions> configureOptions)
{
if (endpoints == null)
{
throw new ArgumentNullException(nameof(endpoints));
}

if (path == null)
{
throw new ArgumentNullException(nameof(path));
}

if (componentType == null)
{
throw new ArgumentNullException(nameof(componentType));
}

if (selector == null)
{
throw new ArgumentNullException(nameof(selector));
}

if (configureOptions == null)
{
throw new ArgumentNullException(nameof(configureOptions));
}

return new ComponentEndpointConventionBuilder(endpoints.MapHub<ComponentHub>(path, configureOptions)).AddComponent(componentType, selector);
}
}
}