mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-13 22:43:35 +01:00
33 lines
972 B
C#
33 lines
972 B
C#
using System;
|
|
using Microsoft.AspNet.SignalR;
|
|
using Microsoft.AspNet.SignalR.Infrastructure;
|
|
using NzbDrone.Common.Composition;
|
|
|
|
namespace NzbDrone.Api.SignalR
|
|
{
|
|
public class SignalrDependencyResolver : DefaultDependencyResolver
|
|
{
|
|
private readonly IContainer _container;
|
|
|
|
public static void Register(IContainer container)
|
|
{
|
|
GlobalHost.DependencyResolver = new SignalrDependencyResolver(container);
|
|
}
|
|
|
|
private SignalrDependencyResolver(IContainer container)
|
|
{
|
|
container.RegisterSingleton(typeof(IPerformanceCounterManager), typeof(NoOpPerformanceCounterManager));
|
|
_container = container;
|
|
}
|
|
|
|
public override object GetService(Type serviceType)
|
|
{
|
|
if (_container.IsTypeRegistered(serviceType))
|
|
{
|
|
return _container.Resolve(serviceType);
|
|
}
|
|
|
|
return base.GetService(serviceType);
|
|
}
|
|
}
|
|
} |