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 08dee32743..e39c5d64ac 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 convention) { } diff --git a/src/Components/Server/src/Builder/ComponentEndpointConventionBuilder.cs b/src/Components/Server/src/Builder/ComponentEndpointConventionBuilder.cs index 150e373a23..021272c7d6 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 0a29e1790d..b7d260d25e 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 64b628f6a4..7810a4985d 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 convention) { } + } public static partial class ConnectionEndpointRouteBuilderExtensions { - public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapConnectionHandler(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern) where TConnectionHandler : Microsoft.AspNetCore.Connections.ConnectionHandler { throw null; } - public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapConnectionHandler(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action 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 configure) { throw null; } - public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapConnections(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action configure) { throw null; } + public static Microsoft.AspNetCore.Builder.ConnectionEndpointRouteBuilder MapConnectionHandler(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern) where TConnectionHandler : Microsoft.AspNetCore.Connections.ConnectionHandler { throw null; } + public static Microsoft.AspNetCore.Builder.ConnectionEndpointRouteBuilder MapConnectionHandler(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action 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 configure) { throw null; } + public static Microsoft.AspNetCore.Builder.ConnectionEndpointRouteBuilder MapConnections(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action 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 0000000000..3c8a57c0cd --- /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 +{ + /// + /// Builds conventions that will be used for customization of Connection instances. + /// + public sealed class ConnectionEndpointRouteBuilder : IEndpointConventionBuilder + { + private readonly IEndpointConventionBuilder _endpointConventionBuilder; + + internal ConnectionEndpointRouteBuilder(IEndpointConventionBuilder endpointConventionBuilder) + { + _endpointConventionBuilder = endpointConventionBuilder; + } + + /// + /// Adds the specified convention to the builder. Conventions are used to customize instances. + /// + /// The convention to add to the builder. + public void Add(Action 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 7833a46600..97ba2b3c0e 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 /// The to add the route to. /// The route pattern. /// A callback to configure the connection. - /// An for endpoints associated with the connections. - public static IEndpointConventionBuilder MapConnections(this IEndpointRouteBuilder endpoints, string pattern, Action configure) => + /// An for endpoints associated with the connections. + public static ConnectionEndpointRouteBuilder MapConnections(this IEndpointRouteBuilder endpoints, string pattern, Action configure) => endpoints.MapConnections(pattern, new HttpConnectionDispatcherOptions(), configure); /// @@ -29,8 +29,8 @@ namespace Microsoft.AspNetCore.Builder /// The type. /// The to add the route to. /// The route pattern. - /// An for endpoints associated with the connections. - public static IEndpointConventionBuilder MapConnectionHandler(this IEndpointRouteBuilder endpoints, string pattern) where TConnectionHandler : ConnectionHandler + /// An for endpoints associated with the connections. + public static ConnectionEndpointRouteBuilder MapConnectionHandler(this IEndpointRouteBuilder endpoints, string pattern) where TConnectionHandler : ConnectionHandler { return endpoints.MapConnectionHandler(pattern, configureOptions: null); } @@ -42,8 +42,8 @@ namespace Microsoft.AspNetCore.Builder /// The to add the route to. /// The route pattern. /// A callback to configure dispatcher options. - /// An for endpoints associated with the connections. - public static IEndpointConventionBuilder MapConnectionHandler(this IEndpointRouteBuilder endpoints, string pattern, Action configureOptions) where TConnectionHandler : ConnectionHandler + /// An for endpoints associated with the connections. + public static ConnectionEndpointRouteBuilder MapConnectionHandler(this IEndpointRouteBuilder endpoints, string pattern, Action configureOptions) where TConnectionHandler : ConnectionHandler { var options = new HttpConnectionDispatcherOptions(); configureOptions?.Invoke(options); @@ -75,8 +75,8 @@ namespace Microsoft.AspNetCore.Builder /// The route pattern. /// Options used to configure the connection. /// A callback to configure the connection. - /// An for endpoints associated with the connections. - public static IEndpointConventionBuilder MapConnections(this IEndpointRouteBuilder endpoints, string pattern, HttpConnectionDispatcherOptions options, Action configure) + /// An for endpoints associated with the connections. + public static ConnectionEndpointRouteBuilder MapConnections(this IEndpointRouteBuilder endpoints, string pattern, HttpConnectionDispatcherOptions options, Action configure) { var dispatcher = endpoints.ServiceProvider.GetRequiredService(); @@ -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 56b62a7317..0021c03cbd 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 convention) { } + } public static partial class HubEndpointRouteBuilderExtensions { - public static Microsoft.AspNetCore.SignalR.HubEndpointConventionBuilder MapHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern) where THub : Microsoft.AspNetCore.SignalR.Hub { throw null; } - public static Microsoft.AspNetCore.SignalR.HubEndpointConventionBuilder MapHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action configureOptions) where THub : Microsoft.AspNetCore.SignalR.Hub { throw null; } + public static Microsoft.AspNetCore.Builder.HubEndpointConventionBuilder MapHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern) where THub : Microsoft.AspNetCore.SignalR.Hub { throw null; } + public static Microsoft.AspNetCore.Builder.HubEndpointConventionBuilder MapHub(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, System.Action 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 convention) { } - } [System.ObsoleteAttribute("This class is obsolete and will be removed in a future version. The recommended alternative is to use MapHub inside Microsoft.AspNetCore.Builder.UseEndpoints(...).")] public partial class HubRouteBuilder { @@ -33,9 +36,6 @@ namespace Microsoft.AspNetCore.SignalR public void MapHub(Microsoft.AspNetCore.Http.PathString path) where THub : Microsoft.AspNetCore.SignalR.Hub { } public void MapHub(Microsoft.AspNetCore.Http.PathString path, System.Action 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 fc2cd2cca0..54be9a6ea7 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 { /// /// Builds conventions that will be used for customization of Hub instances. diff --git a/src/SignalR/server/SignalR/src/IHubEndpointConventionBuilder.cs b/src/SignalR/server/SignalR/src/IHubEndpointConventionBuilder.cs index 141311ccd2..357cbe1ba0 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 { /// /// Abstraction that builds conventions that will be used for customization of Hub instances. /// public interface IHubEndpointConventionBuilder : IEndpointConventionBuilder { - } }