diff --git a/src/Components/Server/ref/Microsoft.AspNetCore.Components.Server.netcoreapp3.0.cs b/src/Components/Server/ref/Microsoft.AspNetCore.Components.Server.netcoreapp3.0.cs index 08dee32743bf295efc5e8d4b6bf1d23c9c8620f5..e39c5d64acf7ae0fcf3fd79f4d2fc22c1e2e8491 100644 --- a/src/Components/Server/ref/Microsoft.AspNetCore.Components.Server.netcoreapp3.0.cs +++ b/src/Components/Server/ref/Microsoft.AspNetCore.Components.Server.netcoreapp3.0.cs @@ -3,7 +3,7 @@ namespace Microsoft.AspNetCore.Builder { - public sealed partial class ComponentEndpointConventionBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder, Microsoft.AspNetCore.SignalR.IHubEndpointConventionBuilder + public sealed partial class ComponentEndpointConventionBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder, Microsoft.AspNetCore.Builder.IHubEndpointConventionBuilder { internal ComponentEndpointConventionBuilder() { } public void Add(System.Action<Microsoft.AspNetCore.Builder.EndpointBuilder> convention) { } diff --git a/src/Components/Server/src/Builder/ComponentEndpointConventionBuilder.cs b/src/Components/Server/src/Builder/ComponentEndpointConventionBuilder.cs index 150e373a233df5a8620e3cedb6d93fcc12fa4d6b..021272c7d672cfd446eaf64d10b18c513d0a8cf6 100644 --- a/src/Components/Server/src/Builder/ComponentEndpointConventionBuilder.cs +++ b/src/Components/Server/src/Builder/ComponentEndpointConventionBuilder.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.SignalR; namespace Microsoft.AspNetCore.Builder { diff --git a/src/Components/Server/src/Builder/ComponentEndpointConventionBuilderExtensions.cs b/src/Components/Server/src/Builder/ComponentEndpointConventionBuilderExtensions.cs index 0a29e1790dc08ab36680aab085ad79382a67c00e..b7d260d25eb6fa3b2772c148704778aa281146e9 100644 --- a/src/Components/Server/src/Builder/ComponentEndpointConventionBuilderExtensions.cs +++ b/src/Components/Server/src/Builder/ComponentEndpointConventionBuilderExtensions.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Components.Server; -using Microsoft.AspNetCore.SignalR; namespace Microsoft.AspNetCore.Builder { diff --git a/src/SignalR/common/Http.Connections/ref/Microsoft.AspNetCore.Http.Connections.netcoreapp3.0.cs b/src/SignalR/common/Http.Connections/ref/Microsoft.AspNetCore.Http.Connections.netcoreapp3.0.cs index 64b628f6a43064c98803f02bfaf08ca48df2f34c..7810a4985d7eea2ee5d80fa654728a1858ab35b2 100644 --- a/src/SignalR/common/Http.Connections/ref/Microsoft.AspNetCore.Http.Connections.netcoreapp3.0.cs +++ b/src/SignalR/common/Http.Connections/ref/Microsoft.AspNetCore.Http.Connections.netcoreapp3.0.cs @@ -3,12 +3,17 @@ namespace Microsoft.AspNetCore.Builder { + public sealed partial class ConnectionEndpointRouteBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder + { + internal ConnectionEndpointRouteBuilder() { } + public void Add(System.Action<Microsoft.AspNetCore.Builder.EndpointBuilder> convention) { } + } public static partial class ConnectionEndpointRouteBuilderExtensions { - public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapConnectionHandler<TConnectionHandler>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern) where TConnectionHandler : Microsoft.AspNetCore.Connections.ConnectionHandler { throw null; } - public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapConnectionHandler<TConnectionHandler>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action<Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) where TConnectionHandler : Microsoft.AspNetCore.Connections.ConnectionHandler { throw null; } - public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapConnections(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions options, System.Action<Microsoft.AspNetCore.Connections.IConnectionBuilder> configure) { throw null; } - public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapConnections(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action<Microsoft.AspNetCore.Connections.IConnectionBuilder> configure) { throw null; } + public static Microsoft.AspNetCore.Builder.ConnectionEndpointRouteBuilder MapConnectionHandler<TConnectionHandler>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern) where TConnectionHandler : Microsoft.AspNetCore.Connections.ConnectionHandler { throw null; } + public static Microsoft.AspNetCore.Builder.ConnectionEndpointRouteBuilder MapConnectionHandler<TConnectionHandler>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action<Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) where TConnectionHandler : Microsoft.AspNetCore.Connections.ConnectionHandler { throw null; } + public static Microsoft.AspNetCore.Builder.ConnectionEndpointRouteBuilder MapConnections(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions options, System.Action<Microsoft.AspNetCore.Connections.IConnectionBuilder> configure) { throw null; } + public static Microsoft.AspNetCore.Builder.ConnectionEndpointRouteBuilder MapConnections(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action<Microsoft.AspNetCore.Connections.IConnectionBuilder> configure) { throw null; } } public static partial class ConnectionsAppBuilderExtensions { diff --git a/src/SignalR/common/Http.Connections/src/ConnectionEndpointRouteBuilder.cs b/src/SignalR/common/Http.Connections/src/ConnectionEndpointRouteBuilder.cs new file mode 100644 index 0000000000000000000000000000000000000000..3c8a57c0cd78954866c6e103ccd835499cf5b04e --- /dev/null +++ b/src/SignalR/common/Http.Connections/src/ConnectionEndpointRouteBuilder.cs @@ -0,0 +1,29 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.AspNetCore.Builder +{ + /// <summary> + /// Builds conventions that will be used for customization of Connection <see cref="EndpointBuilder"/> instances. + /// </summary> + public sealed class ConnectionEndpointRouteBuilder : IEndpointConventionBuilder + { + private readonly IEndpointConventionBuilder _endpointConventionBuilder; + + internal ConnectionEndpointRouteBuilder(IEndpointConventionBuilder endpointConventionBuilder) + { + _endpointConventionBuilder = endpointConventionBuilder; + } + + /// <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) + { + _endpointConventionBuilder.Add(convention); + } + } +} diff --git a/src/SignalR/common/Http.Connections/src/ConnectionEndpointRouteBuilderExtensions.cs b/src/SignalR/common/Http.Connections/src/ConnectionEndpointRouteBuilderExtensions.cs index 7833a466008c1ef646ce078d0f533c97c1297776..97ba2b3c0e9cda4641d680ee5ec2a71a63a765ee 100644 --- a/src/SignalR/common/Http.Connections/src/ConnectionEndpointRouteBuilderExtensions.cs +++ b/src/SignalR/common/Http.Connections/src/ConnectionEndpointRouteBuilderExtensions.cs @@ -19,8 +19,8 @@ namespace Microsoft.AspNetCore.Builder /// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param> /// <param name="pattern">The route pattern.</param> /// <param name="configure">A callback to configure the connection.</param> - /// <returns>An <see cref="IEndpointConventionBuilder"/> for endpoints associated with the connections.</returns> - public static IEndpointConventionBuilder MapConnections(this IEndpointRouteBuilder endpoints, string pattern, Action<IConnectionBuilder> configure) => + /// <returns>An <see cref="ConnectionEndpointRouteBuilder"/> for endpoints associated with the connections.</returns> + public static ConnectionEndpointRouteBuilder MapConnections(this IEndpointRouteBuilder endpoints, string pattern, Action<IConnectionBuilder> configure) => endpoints.MapConnections(pattern, new HttpConnectionDispatcherOptions(), configure); /// <summary> @@ -29,8 +29,8 @@ namespace Microsoft.AspNetCore.Builder /// <typeparam name="TConnectionHandler">The <see cref="ConnectionHandler"/> type.</typeparam> /// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param> /// <param name="pattern">The route pattern.</param> - /// <returns>An <see cref="IEndpointConventionBuilder"/> for endpoints associated with the connections.</returns> - public static IEndpointConventionBuilder MapConnectionHandler<TConnectionHandler>(this IEndpointRouteBuilder endpoints, string pattern) where TConnectionHandler : ConnectionHandler + /// <returns>An <see cref="ConnectionEndpointRouteBuilder"/> for endpoints associated with the connections.</returns> + public static ConnectionEndpointRouteBuilder MapConnectionHandler<TConnectionHandler>(this IEndpointRouteBuilder endpoints, string pattern) where TConnectionHandler : ConnectionHandler { return endpoints.MapConnectionHandler<TConnectionHandler>(pattern, configureOptions: null); } @@ -42,8 +42,8 @@ namespace Microsoft.AspNetCore.Builder /// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param> /// <param name="pattern">The route pattern.</param> /// <param name="configureOptions">A callback to configure dispatcher options.</param> - /// <returns>An <see cref="IEndpointConventionBuilder"/> for endpoints associated with the connections.</returns> - public static IEndpointConventionBuilder MapConnectionHandler<TConnectionHandler>(this IEndpointRouteBuilder endpoints, string pattern, Action<HttpConnectionDispatcherOptions> configureOptions) where TConnectionHandler : ConnectionHandler + /// <returns>An <see cref="ConnectionEndpointRouteBuilder"/> for endpoints associated with the connections.</returns> + public static ConnectionEndpointRouteBuilder MapConnectionHandler<TConnectionHandler>(this IEndpointRouteBuilder endpoints, string pattern, Action<HttpConnectionDispatcherOptions> configureOptions) where TConnectionHandler : ConnectionHandler { var options = new HttpConnectionDispatcherOptions(); configureOptions?.Invoke(options); @@ -75,8 +75,8 @@ namespace Microsoft.AspNetCore.Builder /// <param name="pattern">The route pattern.</param> /// <param name="options">Options used to configure the connection.</param> /// <param name="configure">A callback to configure the connection.</param> - /// <returns>An <see cref="IEndpointConventionBuilder"/> for endpoints associated with the connections.</returns> - public static IEndpointConventionBuilder MapConnections(this IEndpointRouteBuilder endpoints, string pattern, HttpConnectionDispatcherOptions options, Action<IConnectionBuilder> configure) + /// <returns>An <see cref="ConnectionEndpointRouteBuilder"/> for endpoints associated with the connections.</returns> + public static ConnectionEndpointRouteBuilder MapConnections(this IEndpointRouteBuilder endpoints, string pattern, HttpConnectionDispatcherOptions options, Action<IConnectionBuilder> configure) { var dispatcher = endpoints.ServiceProvider.GetRequiredService<HttpConnectionDispatcher>(); @@ -121,7 +121,7 @@ namespace Microsoft.AspNetCore.Builder } }); - return compositeConventionBuilder; + return new ConnectionEndpointRouteBuilder(compositeConventionBuilder); } private class CompositeEndpointConventionBuilder : IEndpointConventionBuilder diff --git a/src/SignalR/server/SignalR/ref/Microsoft.AspNetCore.SignalR.netcoreapp3.0.cs b/src/SignalR/server/SignalR/ref/Microsoft.AspNetCore.SignalR.netcoreapp3.0.cs index 56b62a7317ecf9527c586c18c66ef56b5d72ebae..0021c03cbd8c9a2da0fe8d78f26ea210ef4b3eeb 100644 --- a/src/SignalR/server/SignalR/ref/Microsoft.AspNetCore.SignalR.netcoreapp3.0.cs +++ b/src/SignalR/server/SignalR/ref/Microsoft.AspNetCore.SignalR.netcoreapp3.0.cs @@ -3,10 +3,18 @@ namespace Microsoft.AspNetCore.Builder { + public sealed partial class HubEndpointConventionBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder, Microsoft.AspNetCore.Builder.IHubEndpointConventionBuilder + { + internal HubEndpointConventionBuilder() { } + public void Add(System.Action<Microsoft.AspNetCore.Builder.EndpointBuilder> convention) { } + } public static partial class HubEndpointRouteBuilderExtensions { - public static Microsoft.AspNetCore.SignalR.HubEndpointConventionBuilder MapHub<THub>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern) where THub : Microsoft.AspNetCore.SignalR.Hub { throw null; } - public static Microsoft.AspNetCore.SignalR.HubEndpointConventionBuilder MapHub<THub>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action<Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) where THub : Microsoft.AspNetCore.SignalR.Hub { throw null; } + public static Microsoft.AspNetCore.Builder.HubEndpointConventionBuilder MapHub<THub>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern) where THub : Microsoft.AspNetCore.SignalR.Hub { throw null; } + public static Microsoft.AspNetCore.Builder.HubEndpointConventionBuilder MapHub<THub>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action<Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) where THub : Microsoft.AspNetCore.SignalR.Hub { throw null; } + } + public partial interface IHubEndpointConventionBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder + { } public static partial class SignalRAppBuilderExtensions { @@ -21,11 +29,6 @@ namespace Microsoft.AspNetCore.SignalR public static Microsoft.AspNetCore.Http.HttpContext GetHttpContext(this Microsoft.AspNetCore.SignalR.HubCallerContext connection) { throw null; } public static Microsoft.AspNetCore.Http.HttpContext GetHttpContext(this Microsoft.AspNetCore.SignalR.HubConnectionContext connection) { throw null; } } - public sealed partial class HubEndpointConventionBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder, Microsoft.AspNetCore.SignalR.IHubEndpointConventionBuilder - { - internal HubEndpointConventionBuilder() { } - public void Add(System.Action<Microsoft.AspNetCore.Builder.EndpointBuilder> convention) { } - } [System.ObsoleteAttribute("This class is obsolete and will be removed in a future version. The recommended alternative is to use MapHub<THub> inside Microsoft.AspNetCore.Builder.UseEndpoints(...).")] public partial class HubRouteBuilder { @@ -33,9 +36,6 @@ namespace Microsoft.AspNetCore.SignalR public void MapHub<THub>(Microsoft.AspNetCore.Http.PathString path) where THub : Microsoft.AspNetCore.SignalR.Hub { } public void MapHub<THub>(Microsoft.AspNetCore.Http.PathString path, System.Action<Microsoft.AspNetCore.Http.Connections.HttpConnectionDispatcherOptions> configureOptions) where THub : Microsoft.AspNetCore.SignalR.Hub { } } - public partial interface IHubEndpointConventionBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder - { - } } namespace Microsoft.Extensions.DependencyInjection { diff --git a/src/SignalR/server/SignalR/src/HubEndpointConventionBuilder.cs b/src/SignalR/server/SignalR/src/HubEndpointConventionBuilder.cs index fc2cd2cca03134abca47683028c3a61181bd05e6..54be9a6ea71ce2eae1afbdf5850a3ccc056ced03 100644 --- a/src/SignalR/server/SignalR/src/HubEndpointConventionBuilder.cs +++ b/src/SignalR/server/SignalR/src/HubEndpointConventionBuilder.cs @@ -2,9 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Builder; -namespace Microsoft.AspNetCore.SignalR +namespace Microsoft.AspNetCore.Builder { /// <summary> /// Builds conventions that will be used for customization of Hub <see cref="EndpointBuilder"/> instances. diff --git a/src/SignalR/server/SignalR/src/IHubEndpointConventionBuilder.cs b/src/SignalR/server/SignalR/src/IHubEndpointConventionBuilder.cs index 141311ccd240722faf40b6c04384462a669bdbe2..357cbe1ba0ebd6241eb5b4e048b9abe4caa82539 100644 --- a/src/SignalR/server/SignalR/src/IHubEndpointConventionBuilder.cs +++ b/src/SignalR/server/SignalR/src/IHubEndpointConventionBuilder.cs @@ -1,15 +1,12 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.AspNetCore.Builder; - -namespace Microsoft.AspNetCore.SignalR +namespace Microsoft.AspNetCore.Builder { /// <summary> /// Abstraction that builds conventions that will be used for customization of Hub <see cref="EndpointBuilder"/> instances. /// </summary> public interface IHubEndpointConventionBuilder : IEndpointConventionBuilder { - } }