35 lines
843 B
C#
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));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|