mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed IInitializable registration
I tried to make it all happen in the same method as AutoRegisterImplementations, but it caused issues with BasicRepo.
This commit is contained in:
parent
28d4010c5c
commit
9ae21cf7a1
@ -44,7 +44,7 @@ private void RegisterReporting(TinyIoCContainer container)
|
||||
|
||||
private void KickoffInitilizables(TinyIoCContainer container)
|
||||
{
|
||||
var initilizables = container.Resolve<IEnumerable<IInitializable>>();
|
||||
var initilizables = container.ResolveAll<IInitializable>();
|
||||
|
||||
foreach (var initializable in initilizables)
|
||||
{
|
||||
|
@ -38,14 +38,18 @@ public static void Map()
|
||||
Mapper.Entity<SceneMapping>().RegisterModel("SceneMappings");
|
||||
|
||||
Mapper.Entity<History.History>().RegisterModel("History")
|
||||
.HasOne(h => h.Episode, h => h.EpisodeId);
|
||||
.HasOne(h => h.Episode, h => h.EpisodeId);
|
||||
|
||||
Mapper.Entity<Series>().RegisterModel("Series");
|
||||
|
||||
Mapper.Entity<Season>().RegisterModel("Seasons");
|
||||
Mapper.Entity<Episode>().RegisterModel("Episodes");
|
||||
Mapper.Entity<EpisodeFile>().RegisterModel("EpisodeFiles");
|
||||
Mapper.Entity<QualityProfile>().RegisterModel("QualityProfiles").For(q => q.DbAllowed).SetColumnName("Allowed").Ignore(q => q.Allowed);
|
||||
|
||||
Mapper.Entity<QualityProfile>().RegisterModel("QualityProfiles")
|
||||
.For(q => q.DbAllowed).SetColumnName("Allowed")
|
||||
.Ignore(q => q.Allowed);
|
||||
|
||||
Mapper.Entity<QualitySize>().RegisterModel("QualitySizes");
|
||||
|
||||
Mapper.Entity<Log>().RegisterModel("Logs");
|
||||
|
@ -21,7 +21,6 @@ public List<Series> SearchForNewSeries(string title)
|
||||
return response.Data.Select(MapSeries).ToList();
|
||||
}
|
||||
|
||||
|
||||
public Series GetSeriesInfo(int tvDbSeriesId)
|
||||
{
|
||||
var client = BuildClient("show", "summary");
|
||||
@ -40,7 +39,6 @@ public IList<Episode> GetEpisodeInfo(int tvDbSeriesId)
|
||||
return response.Data.seasons.SelectMany(c => c.episodes).Select(MapEpisode).ToList();
|
||||
}
|
||||
|
||||
|
||||
private static IRestClient BuildClient(string resource, string method)
|
||||
{
|
||||
return new RestClient(string.Format("http://api.trakt.tv/{0}/{1}.json/6fc98f83c6a02decd17eb7e13d00e89c", resource, method));
|
||||
|
@ -13,6 +13,7 @@
|
||||
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 @@ static ContainerBuilder()
|
||||
container.AutoRegisterImplementations<IndexerBase>();
|
||||
container.AutoRegisterImplementations<IndexerSearchBase>();
|
||||
container.AutoRegisterImplementations<ExternalNotificationBase>();
|
||||
container.AutoRegisterMultipleImplementations<IInitializable>();
|
||||
|
||||
container.Register<IEventAggregator, EventAggregator>().AsSingleton();
|
||||
container.Register<INancyBootstrapper, TinyNancyBootstrapper>().AsSingleton();
|
||||
@ -88,13 +90,24 @@ private static void AutoRegisterImplementations<TContract>(this TinyIoCContainer
|
||||
|
||||
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)
|
||||
foreach(var implementation in implementations)
|
||||
{
|
||||
logger.Trace("Registering {0} as {1}", implementation.Name, contractType.Name);
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user