23 lines
571 B
C#
23 lines
571 B
C#
using System;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using xPushService.Interfaces;
|
|
|
|
namespace xPushService.Providers
|
|
{
|
|
public class XHubContextFactory : IXHubContextFactory
|
|
{
|
|
private readonly IServiceProvider services;
|
|
|
|
public XHubContextFactory(IServiceProvider services)
|
|
{
|
|
this.services = services;
|
|
}
|
|
|
|
public IHubContext<THub> Create<THub>()
|
|
where THub : Hub
|
|
{
|
|
return services.GetRequiredService<IHubContext<THub>>();
|
|
}
|
|
}
|
|
} |