1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 12:32:31 +01:00
Radarr/NzbDrone.Api/SignalR/SignalrDependencyResolver.cs
2013-05-10 20:43:52 -07:00

32 lines
810 B
C#

using System;
using Microsoft.AspNet.SignalR;
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 = container;
}
public override object GetService(Type serviceType)
{
if (_container.IsTypeRegistered(serviceType))
{
return _container.Resolve(serviceType);
}
return base.GetService(serviceType);
}
}
}