1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Api/AutofacContainerAdapter.cs
2013-01-02 17:09:13 -08:00

37 lines
710 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autofac;
using ServiceStack.Configuration;
namespace NzbDrone.Api
{
public class AutofacIocAdapter : IContainerAdapter
{
private readonly IContainer _container;
public AutofacIocAdapter(IContainer container)
{
_container = container;
}
public T Resolve<T>()
{
return _container.Resolve<T>();
}
public T TryResolve<T>()
{
T result;
if (_container.TryResolve<T>(out result))
{
return result;
}
return default(T);
}
}
}