|
|
|
@ -13,6 +13,7 @@ using NzbDrone.Core.Datastore.Migration.Framework;
|
|
|
|
|
using NzbDrone.Core.ExternalNotification;
|
|
|
|
|
using NzbDrone.Core.IndexerSearch;
|
|
|
|
|
using NzbDrone.Core.Indexers;
|
|
|
|
|
using NzbDrone.Core.Lifecycle;
|
|
|
|
|
using NzbDrone.Core.RootFolders;
|
|
|
|
|
using TinyIoC;
|
|
|
|
|
|
|
|
|
@ -36,6 +37,7 @@ namespace NzbDrone
|
|
|
|
|
container.AutoRegisterImplementations<IndexerBase>();
|
|
|
|
|
container.AutoRegisterImplementations<IndexerSearchBase>();
|
|
|
|
|
container.AutoRegisterImplementations<ExternalNotificationBase>();
|
|
|
|
|
container.AutoRegisterMultipleImplementations<IInitializable>();
|
|
|
|
|
|
|
|
|
|
container.Register<IEventAggregator, EventAggregator>().AsSingleton();
|
|
|
|
|
container.Register<INancyBootstrapper, TinyNancyBootstrapper>().AsSingleton();
|
|
|
|
@ -88,7 +90,7 @@ namespace NzbDrone
|
|
|
|
|
|
|
|
|
|
private static void AutoRegisterImplementations(this TinyIoCContainer container, Type contractType)
|
|
|
|
|
{
|
|
|
|
|
var implementations = contractType.Assembly.GetImplementations(contractType);
|
|
|
|
|
var implementations = contractType.Assembly.GetImplementations(contractType).ToList();
|
|
|
|
|
|
|
|
|
|
foreach(var implementation in implementations)
|
|
|
|
|
{
|
|
|
|
@ -96,5 +98,16 @@ namespace NzbDrone
|
|
|
|
|
container.Register(contractType, implementation).AsMultiInstance();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void AutoRegisterMultipleImplementations<TContract>(this TinyIoCContainer container)
|
|
|
|
|
{
|
|
|
|
|
container.AutoRegisterMultipleImplementations(typeof(TContract));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void AutoRegisterMultipleImplementations(this TinyIoCContainer container, Type contractType)
|
|
|
|
|
{
|
|
|
|
|
var implementations = contractType.Assembly.GetImplementations(contractType);
|
|
|
|
|
container.RegisterMultiple(contractType, implementations).AsMultiInstance();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|