1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00
Sonarr/NzbDrone.Core/NinjectDependencyResolver.cs
Mark McDowall 5a1039ed8d Fixed ninject 2 reference
Fixed Core.Test reference to Signalr
2012-12-10 23:52:30 -08:00

35 lines
843 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ninject;
using SignalR;
namespace NzbDrone.Core
{
public class NinjectDependencyResolver : DefaultDependencyResolver
{
private readonly IKernel _kernel;
public NinjectDependencyResolver(IKernel kernel)
{
if (kernel == null)
{
throw new ArgumentNullException("kernel");
}
_kernel = kernel;
}
public override object GetService(Type serviceType)
{
return _kernel.TryGet(serviceType) ?? base.GetService(serviceType);
}
public override IEnumerable<object> GetServices(Type serviceType)
{
return _kernel.GetAll(serviceType).Concat(base.GetServices(serviceType));
}
}
}