diff --git a/NzbDrone.Api/NancyBootstrapper.cs b/NzbDrone.Api/NancyBootstrapper.cs index 6fad25955..40388308f 100644 --- a/NzbDrone.Api/NancyBootstrapper.cs +++ b/NzbDrone.Api/NancyBootstrapper.cs @@ -44,7 +44,7 @@ private void RegisterReporting(TinyIoCContainer container) private void KickoffInitilizables(TinyIoCContainer container) { - var initilizables = container.Resolve>(); + var initilizables = container.ResolveAll(); foreach (var initializable in initilizables) { diff --git a/NzbDrone.Core/Datastore/TableMapping.cs b/NzbDrone.Core/Datastore/TableMapping.cs index ec05af36e..e3bbfe373 100644 --- a/NzbDrone.Core/Datastore/TableMapping.cs +++ b/NzbDrone.Core/Datastore/TableMapping.cs @@ -38,14 +38,18 @@ public static void Map() Mapper.Entity().RegisterModel("SceneMappings"); Mapper.Entity().RegisterModel("History") - .HasOne(h => h.Episode, h => h.EpisodeId); + .HasOne(h => h.Episode, h => h.EpisodeId); Mapper.Entity().RegisterModel("Series"); Mapper.Entity().RegisterModel("Seasons"); Mapper.Entity().RegisterModel("Episodes"); Mapper.Entity().RegisterModel("EpisodeFiles"); - Mapper.Entity().RegisterModel("QualityProfiles").For(q => q.DbAllowed).SetColumnName("Allowed").Ignore(q => q.Allowed); + + Mapper.Entity().RegisterModel("QualityProfiles") + .For(q => q.DbAllowed).SetColumnName("Allowed") + .Ignore(q => q.Allowed); + Mapper.Entity().RegisterModel("QualitySizes"); Mapper.Entity().RegisterModel("Logs"); diff --git a/NzbDrone.Core/MetadataSource/TraktProxy.cs b/NzbDrone.Core/MetadataSource/TraktProxy.cs index 951c38772..a77ead0be 100644 --- a/NzbDrone.Core/MetadataSource/TraktProxy.cs +++ b/NzbDrone.Core/MetadataSource/TraktProxy.cs @@ -21,7 +21,6 @@ public List 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 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)); diff --git a/NzbDrone/CommonContainerExtentions.cs b/NzbDrone/CommonContainerExtentions.cs index 40fd40c26..48a1a3e2b 100644 --- a/NzbDrone/CommonContainerExtentions.cs +++ b/NzbDrone/CommonContainerExtentions.cs @@ -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(); container.AutoRegisterImplementations(); container.AutoRegisterImplementations(); + container.AutoRegisterMultipleImplementations(); container.Register().AsSingleton(); container.Register().AsSingleton(); @@ -88,13 +90,24 @@ private static void AutoRegisterImplementations(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(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(); + } } } \ No newline at end of file