diff --git a/src/NzbDrone.Api/NzbDrone.Api.csproj b/src/NzbDrone.Api/NzbDrone.Api.csproj
index deacaca17..540877af7 100644
--- a/src/NzbDrone.Api/NzbDrone.Api.csproj
+++ b/src/NzbDrone.Api/NzbDrone.Api.csproj
@@ -40,6 +40,14 @@
4
+
+ False
+ ..\packages\Nancy.0.23.2\lib\net40\Nancy.dll
+
+
+ False
+ ..\packages\Nancy.Authentication.Basic.0.23.2\lib\net40\Nancy.Authentication.Basic.dll
+
@@ -54,12 +62,6 @@
False
..\packages\Microsoft.AspNet.SignalR.Core.1.1.3\lib\net40\Microsoft.AspNet.SignalR.Core.dll
-
- ..\packages\Nancy.0.21.1\lib\net40\Nancy.dll
-
-
- ..\packages\Nancy.Authentication.Basic.0.21.1\lib\net40\Nancy.Authentication.Basic.dll
-
..\packages\Newtonsoft.Json.5.0.8\lib\net40\Newtonsoft.Json.dll
diff --git a/src/NzbDrone.Api/TinyIoCNancyBootstrapper.cs b/src/NzbDrone.Api/TinyIoCNancyBootstrapper.cs
index 1c25f1e35..0dcf42c16 100644
--- a/src/NzbDrone.Api/TinyIoCNancyBootstrapper.cs
+++ b/src/NzbDrone.Api/TinyIoCNancyBootstrapper.cs
@@ -83,7 +83,20 @@ namespace NzbDrone.Api
{
foreach (var typeRegistration in typeRegistrations)
{
- container.Register(typeRegistration.RegistrationType, typeRegistration.ImplementationType).AsSingleton();
+ switch (typeRegistration.Lifetime)
+ {
+ case Lifetime.Transient:
+ container.Register(typeRegistration.RegistrationType, typeRegistration.ImplementationType).AsMultiInstance();
+ break;
+ case Lifetime.Singleton:
+ container.Register(typeRegistration.RegistrationType, typeRegistration.ImplementationType).AsSingleton();
+ break;
+ case Lifetime.PerRequest:
+ throw new InvalidOperationException("Unable to directly register a per request lifetime.");
+ break;
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
}
}
@@ -97,7 +110,20 @@ namespace NzbDrone.Api
{
foreach (var collectionTypeRegistration in collectionTypeRegistrationsn)
{
- container.RegisterMultiple(collectionTypeRegistration.RegistrationType, collectionTypeRegistration.ImplementationTypes);
+ switch (collectionTypeRegistration.Lifetime)
+ {
+ case Lifetime.Transient:
+ container.RegisterMultiple(collectionTypeRegistration.RegistrationType, collectionTypeRegistration.ImplementationTypes).AsMultiInstance();
+ break;
+ case Lifetime.Singleton:
+ container.RegisterMultiple(collectionTypeRegistration.RegistrationType, collectionTypeRegistration.ImplementationTypes).AsSingleton();
+ break;
+ case Lifetime.PerRequest:
+ throw new InvalidOperationException("Unable to directly register a per request lifetime.");
+ break;
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
}
}
@@ -160,13 +186,24 @@ namespace NzbDrone.Api
return this.ApplicationContainer.ResolveAll(false);
}
+ ///
+ /// Gets all registered request startup tasks
+ ///
+ /// An instance containing instances.
+ protected override IEnumerable RegisterAndGetRequestStartupTasks(TinyIoCContainer container, Type[] requestStartupTypes)
+ {
+ container.RegisterMultiple(typeof(IRequestStartup), requestStartupTypes);
+
+ return container.ResolveAll(false);
+ }
+
///
/// Gets all registered application registration tasks
///
- /// An instance containing instances.
- protected override IEnumerable GetApplicationRegistrationTasks()
+ /// An instance containing instances.
+ protected override IEnumerable GetRegistrationTasks()
{
- return this.ApplicationContainer.ResolveAll(false);
+ return this.ApplicationContainer.ResolveAll(false);
}
///
@@ -201,9 +238,7 @@ namespace NzbDrone.Api
{
var assembly = typeof(NancyEngine).Assembly;
- var whitelist = new Type[] { };
-
- container.AutoRegister(AppDomain.CurrentDomain.GetAssemblies().Where(a => !ignoredAssemblies.Any(ia => ia(a))), DuplicateImplementationActions.RegisterMultiple, t => t.Assembly != assembly || whitelist.Any(wt => wt == t));
+ container.AutoRegister(AppDomain.CurrentDomain.GetAssemblies().Where(a => !ignoredAssemblies.Any(ia => ia(a))), DuplicateImplementationActions.RegisterMultiple, t => t.Assembly != assembly);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/NzbDrone.Api/packages.config b/src/NzbDrone.Api/packages.config
index d7ee10e3a..9dbc20788 100644
--- a/src/NzbDrone.Api/packages.config
+++ b/src/NzbDrone.Api/packages.config
@@ -2,8 +2,8 @@
-
-
+
+
diff --git a/src/NzbDrone.Host/NzbDrone.Host.csproj b/src/NzbDrone.Host/NzbDrone.Host.csproj
index f95e3ffa2..98d5d314c 100644
--- a/src/NzbDrone.Host/NzbDrone.Host.csproj
+++ b/src/NzbDrone.Host/NzbDrone.Host.csproj
@@ -57,6 +57,14 @@
OnOutputUpdated
+
+ False
+ ..\packages\Nancy.0.23.2\lib\net40\Nancy.dll
+
+
+ False
+ ..\packages\Nancy.Owin.0.23.2\lib\net40\Nancy.Owin.dll
+
@@ -73,12 +81,6 @@
..\packages\Microsoft.Owin.Hosting.1.1.0-beta2\lib\net40\Microsoft.Owin.Hosting.dll
-
- ..\packages\Nancy.0.21.1\lib\net40\Nancy.dll
-
-
- ..\packages\Nancy.Owin.0.21.1\lib\net40\Nancy.Owin.dll
-
..\packages\Newtonsoft.Json.5.0.8\lib\net40\Newtonsoft.Json.dll
diff --git a/src/NzbDrone.Host/packages.config b/src/NzbDrone.Host/packages.config
index d9d7f38c3..81dc226c1 100644
--- a/src/NzbDrone.Host/packages.config
+++ b/src/NzbDrone.Host/packages.config
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj b/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj
index d86f1890c..d51da72c9 100644
--- a/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj
+++ b/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj
@@ -38,6 +38,14 @@
4
+
+ False
+ ..\packages\Nancy.0.23.2\lib\net40\Nancy.dll
+
+
+ False
+ ..\packages\Nancy.Owin.0.23.2\lib\net40\Nancy.Owin.dll
+
@@ -66,12 +74,6 @@
..\packages\Moq.4.0.10827\lib\NET40\Moq.dll
-
- ..\packages\Nancy.0.21.1\lib\net40\Nancy.dll
-
-
- ..\packages\Nancy.Owin.0.21.1\lib\net40\Nancy.Owin.dll
-
..\packages\Newtonsoft.Json.5.0.8\lib\net40\Newtonsoft.Json.dll
diff --git a/src/NzbDrone.Integration.Test/packages.config b/src/NzbDrone.Integration.Test/packages.config
index 39bda9dde..ab0dcc448 100644
--- a/src/NzbDrone.Integration.Test/packages.config
+++ b/src/NzbDrone.Integration.Test/packages.config
@@ -7,8 +7,8 @@
-
-
+
+