Selector/Selector.Web/Services/CacheHubProxy.cs

38 lines
1.1 KiB
C#
Raw Normal View History

2021-11-03 22:27:50 +00:00
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.SignalR;
using StackExchange.Redis;
using Selector.Web.Hubs;
namespace Selector.Web.Service
{
public class CacheHubProxy
{
private readonly ILogger<CacheHubProxy> Logger;
private readonly ISubscriber Subscriber;
2021-11-05 07:58:48 +00:00
private readonly IServiceProvider Services;
2021-11-03 22:27:50 +00:00
public CacheHubProxy(ILogger<CacheHubProxy> logger,
ISubscriber subscriber,
2021-11-05 07:58:48 +00:00
IServiceProvider services
2021-11-03 22:27:50 +00:00
)
{
Logger = logger;
Subscriber = subscriber;
Services = services;
}
public void FormMapping<THub, T>(ICacheHubMapping<THub, T> mapping) where THub: Hub<T> where T: class
{
var context = Services.GetService<IHubContext<THub, T>>();
mapping.ConstructMapping(Subscriber, context);
}
}
}