1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-27 10:19:41 +00:00
Radarr/NzbDrone.Api/SignalR/SignalrDependencyResolver.cs

32 lines
810 B
C#
Raw Normal View History

2013-05-05 21:24:33 +00:00
using System;
using Microsoft.AspNet.SignalR;
2013-05-10 23:53:50 +00:00
using NzbDrone.Common.Composition;
2013-05-05 21:24:33 +00:00
namespace NzbDrone.Api.SignalR
{
public class SignalrDependencyResolver : DefaultDependencyResolver
{
2013-05-10 23:53:50 +00:00
private readonly IContainer _container;
2013-05-05 21:24:33 +00:00
2013-05-10 23:53:50 +00:00
public static void Register(IContainer container)
2013-05-05 21:24:33 +00:00
{
GlobalHost.DependencyResolver = new SignalrDependencyResolver(container);
}
2013-05-10 23:53:50 +00:00
private SignalrDependencyResolver(IContainer container)
2013-05-05 21:24:33 +00:00
{
_container = container;
}
public override object GetService(Type serviceType)
{
2013-05-10 23:53:50 +00:00
if (_container.IsTypeRegistered(serviceType))
{
return _container.Resolve(serviceType);
}
2013-05-05 21:24:33 +00:00
2013-05-10 23:53:50 +00:00
return base.GetService(serviceType);
2013-05-05 21:24:33 +00:00
}
}
}