From 3e906fb64a9b8cc328895749f48bf302f114a85a Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Tue, 1 May 2018 17:51:08 -0700 Subject: [PATCH] Minor API cleanup (#2147) --- .../ConnectionsRouteBuilder.cs | 7 +---- .../Internal/TimerAwaitable.cs | 2 +- .../DynamicHubClients.cs | 4 +-- ...sExtensions.cs => HubClientsExtensions.cs} | 2 +- .../RedisDependencyInjectionExtensions.cs | 28 +++++++++---------- .../SignalRDependencyInjectionExtensions.cs | 12 ++++---- 6 files changed, 25 insertions(+), 30 deletions(-) rename src/Microsoft.AspNetCore.SignalR.Core/{IHubClientsExtensions.cs => HubClientsExtensions.cs} (99%) diff --git a/src/Microsoft.AspNetCore.Http.Connections/ConnectionsRouteBuilder.cs b/src/Microsoft.AspNetCore.Http.Connections/ConnectionsRouteBuilder.cs index da7ca1b637..5bda6e6648 100644 --- a/src/Microsoft.AspNetCore.Http.Connections/ConnectionsRouteBuilder.cs +++ b/src/Microsoft.AspNetCore.Http.Connections/ConnectionsRouteBuilder.cs @@ -18,12 +18,7 @@ namespace Microsoft.AspNetCore.Http.Connections private readonly HttpConnectionDispatcher _dispatcher; private readonly RouteBuilder _routes; - /// - /// Initializes a new instance of the class. - /// - /// The underlying . - /// The dispatcher. - public ConnectionsRouteBuilder(RouteBuilder routes, HttpConnectionDispatcher dispatcher) + internal ConnectionsRouteBuilder(RouteBuilder routes, HttpConnectionDispatcher dispatcher) { _routes = routes; _dispatcher = dispatcher; diff --git a/src/Microsoft.AspNetCore.Http.Connections/Internal/TimerAwaitable.cs b/src/Microsoft.AspNetCore.Http.Connections/Internal/TimerAwaitable.cs index e07cf09fd6..bb3e826b07 100644 --- a/src/Microsoft.AspNetCore.Http.Connections/Internal/TimerAwaitable.cs +++ b/src/Microsoft.AspNetCore.Http.Connections/Internal/TimerAwaitable.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.Http.Connections.Internal { - public class TimerAwaitable : IDisposable, ICriticalNotifyCompletion + internal class TimerAwaitable : IDisposable, ICriticalNotifyCompletion { private Timer _timer; private Action _callback; diff --git a/src/Microsoft.AspNetCore.SignalR.Core/DynamicHubClients.cs b/src/Microsoft.AspNetCore.SignalR.Core/DynamicHubClients.cs index 8d3b43ddef..d4d585342b 100644 --- a/src/Microsoft.AspNetCore.SignalR.Core/DynamicHubClients.cs +++ b/src/Microsoft.AspNetCore.SignalR.Core/DynamicHubClients.cs @@ -97,8 +97,8 @@ namespace Microsoft.AspNetCore.SignalR /// /// Gets an object that can be used to invoke methods on all connections associated with all of the specified users. /// - /// The user IDs. + /// The user IDs. /// An object that can be used to invoke methods. - public dynamic Users(IReadOnlyList users) => new DynamicClientProxy(_clients.Users(users)); + public dynamic Users(IReadOnlyList userIds) => new DynamicClientProxy(_clients.Users(userIds)); } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.SignalR.Core/IHubClientsExtensions.cs b/src/Microsoft.AspNetCore.SignalR.Core/HubClientsExtensions.cs similarity index 99% rename from src/Microsoft.AspNetCore.SignalR.Core/IHubClientsExtensions.cs rename to src/Microsoft.AspNetCore.SignalR.Core/HubClientsExtensions.cs index 18f8c02205..8936bbc979 100644 --- a/src/Microsoft.AspNetCore.SignalR.Core/IHubClientsExtensions.cs +++ b/src/Microsoft.AspNetCore.SignalR.Core/HubClientsExtensions.cs @@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.SignalR /// /// Extension methods for . /// - public static class IHubClientsExtensions + public static class HubClientsExtensions { /// /// Gets a that can be used to invoke methods on all clients connected to the hub excluding the specified connection. diff --git a/src/Microsoft.AspNetCore.SignalR.Redis/RedisDependencyInjectionExtensions.cs b/src/Microsoft.AspNetCore.SignalR.Redis/RedisDependencyInjectionExtensions.cs index 61f240fd72..75318cde9a 100644 --- a/src/Microsoft.AspNetCore.SignalR.Redis/RedisDependencyInjectionExtensions.cs +++ b/src/Microsoft.AspNetCore.SignalR.Redis/RedisDependencyInjectionExtensions.cs @@ -16,22 +16,22 @@ namespace Microsoft.Extensions.DependencyInjection /// /// Adds scale-out to a , using a shared Redis server. /// - /// The . + /// The . /// The same instance of the for chaining. - public static ISignalRServerBuilder AddRedis(this ISignalRServerBuilder builder) + public static ISignalRServerBuilder AddRedis(this ISignalRServerBuilder signalrBuilder) { - return AddRedis(builder, o => { }); + return AddRedis(signalrBuilder, o => { }); } /// /// Adds scale-out to a , using a shared Redis server. /// - /// The . + /// The . /// The connection string used to connect to the Redis server. /// The same instance of the for chaining. - public static ISignalRServerBuilder AddRedis(this ISignalRServerBuilder builder, string redisConnectionString) + public static ISignalRServerBuilder AddRedis(this ISignalRServerBuilder signalrBuilder, string redisConnectionString) { - return AddRedis(builder, o => + return AddRedis(signalrBuilder, o => { o.Configuration = ConfigurationOptions.Parse(redisConnectionString); }); @@ -40,26 +40,26 @@ namespace Microsoft.Extensions.DependencyInjection /// /// Adds scale-out to a , using a shared Redis server. /// - /// The . + /// The . /// A callback to configure the Redis options. /// The same instance of the for chaining. - public static ISignalRServerBuilder AddRedis(this ISignalRServerBuilder builder, Action configure) + public static ISignalRServerBuilder AddRedis(this ISignalRServerBuilder signalrBuilder, Action configure) { - builder.Services.Configure(configure); - builder.Services.AddSingleton(typeof(HubLifetimeManager<>), typeof(RedisHubLifetimeManager<>)); - return builder; + signalrBuilder.Services.Configure(configure); + signalrBuilder.Services.AddSingleton(typeof(HubLifetimeManager<>), typeof(RedisHubLifetimeManager<>)); + return signalrBuilder; } /// /// Adds scale-out to a , using a shared Redis server. /// - /// The . + /// The . /// The connection string used to connect to the Redis server. /// A callback to configure the Redis options. /// The same instance of the for chaining. - public static ISignalRServerBuilder AddRedis(this ISignalRServerBuilder builder, string redisConnectionString, Action configure) + public static ISignalRServerBuilder AddRedis(this ISignalRServerBuilder signalrBuilder, string redisConnectionString, Action configure) { - return AddRedis(builder, o => + return AddRedis(signalrBuilder, o => { o.Configuration = ConfigurationOptions.Parse(redisConnectionString); configure(o); diff --git a/src/Microsoft.AspNetCore.SignalR/SignalRDependencyInjectionExtensions.cs b/src/Microsoft.AspNetCore.SignalR/SignalRDependencyInjectionExtensions.cs index 76fde233f5..dfc3c9e644 100644 --- a/src/Microsoft.AspNetCore.SignalR/SignalRDependencyInjectionExtensions.cs +++ b/src/Microsoft.AspNetCore.SignalR/SignalRDependencyInjectionExtensions.cs @@ -18,12 +18,12 @@ namespace Microsoft.Extensions.DependencyInjection /// /// The hub type to configure. /// The . - /// A callback to configure the hub options. + /// A callback to configure the hub options. /// The same instance of the for chaining. - public static ISignalRServerBuilder AddHubOptions(this ISignalRServerBuilder signalrBuilder, Action> options) where THub : Hub + public static ISignalRServerBuilder AddHubOptions(this ISignalRServerBuilder signalrBuilder, Action> configure) where THub : Hub { signalrBuilder.Services.AddSingleton>, HubOptionsSetup>(); - signalrBuilder.Services.Configure(options); + signalrBuilder.Services.Configure(configure); return signalrBuilder; } @@ -44,11 +44,11 @@ namespace Microsoft.Extensions.DependencyInjection /// Adds SignalR services to the specified . /// /// The to add services to. - /// An to configure the provided . + /// An to configure the provided . /// An that can be used to further configure the SignalR services. - public static ISignalRServerBuilder AddSignalR(this IServiceCollection services, Action options) + public static ISignalRServerBuilder AddSignalR(this IServiceCollection services, Action configure) { - return services.Configure(options) + return services.Configure(configure) .AddSignalR(); } }