You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readarr/NzbDrone.Api/TinyIoCDependencyResolver.cs

40 lines
1.0 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using SignalR;
using TinyIoC;
namespace NzbDrone.Api
{
public class TinyIoCDependencyResolver : DefaultDependencyResolver
{
private readonly TinyIoCContainer _container;
public TinyIoCDependencyResolver(TinyIoCContainer container)
{
_container = container;
}
public override object GetService(Type serviceType)
{
if (_container.CanResolve(serviceType))
{
return _container.Resolve(serviceType);
}
return base.GetService(serviceType);
}
public override IEnumerable<object> GetServices(Type serviceType)
{
IEnumerable<object> services = new object[] { };
if (_container.CanResolve(serviceType))
{
services = _container.ResolveAll(serviceType);
}
return services.Concat(base.GetServices(serviceType));
}
}
}