using Microsoft.Azure.NotificationHubs; namespace Bit.Core.NotificationHub; public class NotificationHubClientProxy : INotificationHubProxy { private readonly IEnumerable _clients; public NotificationHubClientProxy(IEnumerable clients) { _clients = clients; } private async Task<(INotificationHubClient, T)[]> ApplyToAllClientsAsync(Func> action) { var tasks = _clients.Select(async c => (c, await action(c))); return await Task.WhenAll(tasks); } // partial proxy of INotificationHubClient implementation // Note: Any other methods that are needed can simply be delegated as done here. public async Task<(INotificationHubClient Client, NotificationOutcome Outcome)[]> SendTemplateNotificationAsync(IDictionary properties, string tagExpression) { return await ApplyToAllClientsAsync(async c => await c.SendTemplateNotificationAsync(properties, tagExpression)); } }