mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
31 lines
No EOL
920 B
C#
31 lines
No EOL
920 B
C#
using System;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using Autofac;
|
|
|
|
namespace NzbDrone.Common
|
|
{
|
|
public static class CommonContainerExtensions
|
|
{
|
|
public static void RegisterCommonServices(this ContainerBuilder containerBuilder)
|
|
{
|
|
containerBuilder.RegisterAssemblyTypes("NzbDrone.Common");
|
|
}
|
|
|
|
public static void RegisterAssemblyTypes(this ContainerBuilder containerBuilder, string assemblyName)
|
|
{
|
|
var apiAssembly = Assembly.Load(assemblyName);
|
|
|
|
if (apiAssembly == null)
|
|
{
|
|
throw new ApplicationException("Couldn't load assembly " + assemblyName);
|
|
}
|
|
|
|
containerBuilder.RegisterAssemblyTypes(apiAssembly)
|
|
.AsImplementedInterfaces();
|
|
|
|
containerBuilder.RegisterAssemblyTypes(apiAssembly)
|
|
.AsSelf();
|
|
}
|
|
}
|
|
} |