2021-11-03 22:27:50 +00:00
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
2021-11-05 07:58:48 +00:00
|
|
|
|
|
|
|
|
|
using Selector.Web.Hubs;
|
2021-11-03 22:27:50 +00:00
|
|
|
|
|
|
|
|
|
namespace Selector.Web.Service
|
|
|
|
|
{
|
2021-11-05 07:58:48 +00:00
|
|
|
|
public interface IUserMappingFactory<out TMap, THub, T>
|
|
|
|
|
where TMap : ICacheHubMapping<THub, T>
|
|
|
|
|
where THub : Hub<T>
|
|
|
|
|
where T : class
|
|
|
|
|
{
|
|
|
|
|
public TMap Get(string userId, string username);
|
2021-11-03 22:27:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-05 07:58:48 +00:00
|
|
|
|
public interface INowPlayingMappingFactory: IUserMappingFactory<NowPlayingMapping, NowPlayingHub, INowPlayingHubClient>
|
|
|
|
|
{ }
|
|
|
|
|
|
2021-11-03 22:27:50 +00:00
|
|
|
|
public class NowPlayingMappingFactory : INowPlayingMappingFactory {
|
|
|
|
|
|
|
|
|
|
private readonly ILoggerFactory LoggerFactory;
|
|
|
|
|
|
|
|
|
|
public NowPlayingMappingFactory(ILoggerFactory loggerFactory)
|
|
|
|
|
{
|
|
|
|
|
LoggerFactory = loggerFactory;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-05 07:58:48 +00:00
|
|
|
|
public NowPlayingMapping Get(string userId, string username)
|
2021-11-03 22:27:50 +00:00
|
|
|
|
{
|
|
|
|
|
return new NowPlayingMapping(
|
|
|
|
|
LoggerFactory?.CreateLogger<NowPlayingMapping>(),
|
2021-11-05 07:58:48 +00:00
|
|
|
|
userId,
|
|
|
|
|
username
|
2021-11-03 22:27:50 +00:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|