Skip to content

Add an extension method Users to IHubClients witch takes IEnumerable parameter #17360

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 5 commits into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -84,6 +84,7 @@ protected HubCallerContext() { }
}
public static partial class HubClientsExtensions
{
public static T AllExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, System.Collections.Generic.IEnumerable<string> excludedConnectionIds) { throw null; }
public static T AllExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string excludedConnectionId1) { throw null; }
public static T AllExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string excludedConnectionId1, string excludedConnectionId2) { throw null; }
public static T AllExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string excludedConnectionId1, string excludedConnectionId2, string excludedConnectionId3) { throw null; }
Expand All @@ -92,6 +93,7 @@ public static partial class HubClientsExtensions
public static T AllExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string excludedConnectionId1, string excludedConnectionId2, string excludedConnectionId3, string excludedConnectionId4, string excludedConnectionId5, string excludedConnectionId6) { throw null; }
public static T AllExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string excludedConnectionId1, string excludedConnectionId2, string excludedConnectionId3, string excludedConnectionId4, string excludedConnectionId5, string excludedConnectionId6, string excludedConnectionId7) { throw null; }
public static T AllExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string excludedConnectionId1, string excludedConnectionId2, string excludedConnectionId3, string excludedConnectionId4, string excludedConnectionId5, string excludedConnectionId6, string excludedConnectionId7, string excludedConnectionId8) { throw null; }
public static T Clients<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, System.Collections.Generic.IEnumerable<string> connectionIds) { throw null; }
public static T Clients<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string connection1) { throw null; }
public static T Clients<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string connection1, string connection2) { throw null; }
public static T Clients<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string connection1, string connection2, string connection3) { throw null; }
Expand All @@ -100,6 +102,7 @@ public static partial class HubClientsExtensions
public static T Clients<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string connection1, string connection2, string connection3, string connection4, string connection5, string connection6) { throw null; }
public static T Clients<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string connection1, string connection2, string connection3, string connection4, string connection5, string connection6, string connection7) { throw null; }
public static T Clients<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string connection1, string connection2, string connection3, string connection4, string connection5, string connection6, string connection7, string connection8) { throw null; }
public static T GroupExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string groupName, System.Collections.Generic.IEnumerable<string> excludedConnectionIds) { throw null; }
public static T GroupExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string groupName, string excludedConnectionId1) { throw null; }
public static T GroupExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string groupName, string excludedConnectionId1, string excludedConnectionId2) { throw null; }
public static T GroupExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string groupName, string excludedConnectionId1, string excludedConnectionId2, string excludedConnectionId3) { throw null; }
Expand All @@ -108,6 +111,7 @@ public static partial class HubClientsExtensions
public static T GroupExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string groupName, string excludedConnectionId1, string excludedConnectionId2, string excludedConnectionId3, string excludedConnectionId4, string excludedConnectionId5, string excludedConnectionId6) { throw null; }
public static T GroupExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string groupName, string excludedConnectionId1, string excludedConnectionId2, string excludedConnectionId3, string excludedConnectionId4, string excludedConnectionId5, string excludedConnectionId6, string excludedConnectionId7) { throw null; }
public static T GroupExcept<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string groupName, string excludedConnectionId1, string excludedConnectionId2, string excludedConnectionId3, string excludedConnectionId4, string excludedConnectionId5, string excludedConnectionId6, string excludedConnectionId7, string excludedConnectionId8) { throw null; }
public static T Groups<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, System.Collections.Generic.IEnumerable<string> groupNames) { throw null; }
public static T Groups<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string group1) { throw null; }
public static T Groups<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string group1, string group2) { throw null; }
public static T Groups<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string group1, string group2, string group3) { throw null; }
Expand All @@ -116,6 +120,7 @@ public static partial class HubClientsExtensions
public static T Groups<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string group1, string group2, string group3, string group4, string group5, string group6) { throw null; }
public static T Groups<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string group1, string group2, string group3, string group4, string group5, string group6, string group7) { throw null; }
public static T Groups<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string group1, string group2, string group3, string group4, string group5, string group6, string group7, string group8) { throw null; }
public static T Users<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, System.Collections.Generic.IEnumerable<string> userIds) { throw null; }
public static T Users<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string user1) { throw null; }
public static T Users<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string user1, string user2) { throw null; }
public static T Users<T>(this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string user1, string user2, string user3) { throw null; }
Expand Down
57 changes: 57 additions & 0 deletions src/SignalR/server/Core/src/HubClientsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections.Generic;
using System.Linq;

namespace Microsoft.AspNetCore.SignalR
{
Expand Down Expand Up @@ -126,6 +127,17 @@ public static T AllExcept<T>(this IHubClients<T> hubClients, string excludedConn
return hubClients.AllExcept(new [] { excludedConnectionId1, excludedConnectionId2, excludedConnectionId3, excludedConnectionId4, excludedConnectionId5, excludedConnectionId6, excludedConnectionId7, excludedConnectionId8 });
}

/// <summary>
/// Gets a <typeparamref name="T" /> that can be used to invoke methods on all clients connected to the hub excluding the specified connections.
/// </summary>
/// <param name="hubClients">The abstraction that provides access to connections.</param>
/// <param name="excludedConnectionIds">The connection IDs to exclude.</param>
/// <returns>A <typeparamref name="T" /> representing the methods that can be invoked on the clients.</returns>
public static T AllExcept<T>(this IHubClients<T> hubClients, IEnumerable<string> excludedConnectionIds)
{
return hubClients.AllExcept(excludedConnectionIds.ToList());
}

/// <summary>
/// Gets a <typeparamref name="T" /> that can be used to invoke methods on the specified connections.
/// </summary>
Expand Down Expand Up @@ -242,6 +254,17 @@ public static T Clients<T>(this IHubClients<T> hubClients, string connection1, s
return hubClients.Clients(new [] { connection1, connection2, connection3, connection4, connection5, connection6, connection7, connection8 });
}

/// <summary>
/// Gets a <typeparamref name="T" /> that can be used to invoke methods on the specified connections.
/// </summary>
/// <param name="hubClients">The abstraction that provides access to connections.</param>
/// <param name="connectionIds">The connection IDs.</param>
/// <returns>A <typeparamref name="T" /> representing the methods that can be invoked on the clients.</returns>
public static T Clients<T>(this IHubClients<T> hubClients, IEnumerable<string> connectionIds)
{
return hubClients.Clients(connectionIds.ToList());
}

/// <summary>
/// Gets a <typeparamref name="T" /> that can be used to invoke methods on all connections in all of the specified groups.
/// </summary>
Expand Down Expand Up @@ -358,6 +381,17 @@ public static T Groups<T>(this IHubClients<T> hubClients, string group1, string
return hubClients.Groups(new [] { group1, group2, group3, group4, group5, group6, group7, group8 });
}

/// <summary>
/// Gets a <typeparamref name="T" /> that can be used to invoke methods on all connections in all of the specified groups.
/// </summary>
/// <param name="hubClients">The abstraction that provides access to connections.</param>
/// <param name="groupNames">The group names.</param>
/// <returns>A <typeparamref name="T" /> representing the methods that can be invoked on the clients.</returns>
public static T Groups<T>(this IHubClients<T> hubClients, IEnumerable<string> groupNames)
{
return hubClients.Groups(groupNames.ToList());
}

/// <summary>
/// Gets a <typeparamref name="T" /> that can be used to invoke methods on all connections in the specified group excluding the specified connections.
/// </summary>
Expand Down Expand Up @@ -482,6 +516,18 @@ public static T GroupExcept<T>(this IHubClients<T> hubClients, string groupName,
return hubClients.GroupExcept(groupName, new [] { excludedConnectionId1, excludedConnectionId2, excludedConnectionId3, excludedConnectionId4, excludedConnectionId5, excludedConnectionId6, excludedConnectionId7, excludedConnectionId8 });
}

/// <summary>
/// Gets a <typeparamref name="T" /> that can be used to invoke methods on all connections in the specified group excluding the specified connections.
/// </summary>
/// <param name="hubClients">The abstraction that provides access to connections.</param>
/// <param name="groupName">The group name.</param>
/// <param name="excludedConnectionIds">The connection IDs to exclude.</param>
/// <returns>A <typeparamref name="T" /> representing the methods that can be invoked on the clients.</returns>
public static T GroupExcept<T>(this IHubClients<T> hubClients, string groupName, IEnumerable<string> excludedConnectionIds)
{
return hubClients.GroupExcept(groupName, excludedConnectionIds.ToList());
}

/// <summary>
/// Gets a <typeparamref name="T" /> that can be used to invoke methods on all connections associated with all of the specified users.
/// </summary>
Expand Down Expand Up @@ -597,5 +643,16 @@ public static T Users<T>(this IHubClients<T> hubClients, string user1, string us
{
return hubClients.Users(new [] { user1, user2, user3, user4, user5, user6, user7, user8 });
}

/// <summary>
/// Gets a <typeparamref name="T" /> that can be used to invoke methods on all connections associated with all of the specified users.
/// </summary>
/// <param name="hubClients">The abstraction that provides access to connections.</param>
/// <param name="userIds">The user IDs.</param>
/// <returns>A <typeparamref name="T" /> representing the methods that can be invoked on the clients.</returns>
public static T Users<T>(this IHubClients<T> hubClients, IEnumerable<string> userIds)
{
return hubClients.Users(userIds.ToList());
}
}
}