1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-25 17:27:18 +00:00
Sonarr/NzbDrone.Api/TinyIoCDependencyResolver.cs
2013-04-02 19:20:05 -07:00

40 lines
No EOL
1 KiB
C#

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));
}
}
}