Upgraded Nancy!!!!

pull/4/head
Keivan Beigi 8 years ago
parent 2a7ae96906
commit cf58e52f40

@ -44,16 +44,17 @@
<HintPath>..\packages\FluentValidation.6.2.1.0\lib\portable-net40+sl50+wp80+win8+wpa81\FluentValidation.dll</HintPath> <HintPath>..\packages\FluentValidation.6.2.1.0\lib\portable-net40+sl50+wp80+win8+wpa81\FluentValidation.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Nancy, Version=0.23.2.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Nancy, Version=1.4.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <HintPath>..\packages\Nancy.1.4.3\lib\net40\Nancy.dll</HintPath>
<HintPath>..\packages\Nancy.0.23.2\lib\net40\Nancy.dll</HintPath> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Nancy.Authentication.Basic, Version=0.23.2.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Nancy.Authentication.Basic, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <HintPath>..\packages\Nancy.Authentication.Basic.1.4.1\lib\net40\Nancy.Authentication.Basic.dll</HintPath>
<HintPath>..\packages\Nancy.Authentication.Basic.0.23.2\lib\net40\Nancy.Authentication.Basic.dll</HintPath> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Nancy.Authentication.Forms"> <Reference Include="Nancy.Authentication.Forms, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Authentication.Forms.0.23.2\lib\net40\Nancy.Authentication.Forms.dll</HintPath> <HintPath>..\packages\Nancy.Authentication.Forms.1.4.1\lib\net40\Nancy.Authentication.Forms.dll</HintPath>
<Private>True</Private>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>

@ -1,28 +1,34 @@
using System; using TinyIoC;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using Nancy; using Nancy;
using Nancy.Bootstrapper;
using Nancy.Diagnostics; using Nancy.Diagnostics;
using TinyIoC; using Nancy.Bootstrapper;
namespace NzbDrone.Api namespace NzbDrone.Api
{ {
/// <summary>
/// TinyIoC bootstrapper - registers default route resolver and registers itself as
/// INancyModuleCatalog for resolving modules but behaviour can be overridden if required.
/// </summary>
public class TinyIoCNancyBootstrapper : NancyBootstrapperWithRequestContainerBase<TinyIoCContainer> public class TinyIoCNancyBootstrapper : NancyBootstrapperWithRequestContainerBase<TinyIoCContainer>
{ {
// <summary> /// <summary>
/// Default assemblies that are ignored for autoregister /// Default assemblies that are ignored for autoregister
/// </summary> /// </summary>
private static readonly IEnumerable<Func<Assembly, bool>> DefaultAutoRegisterIgnoredAssemblies = new Func<Assembly, bool>[] public static IEnumerable<Func<Assembly, bool>> DefaultAutoRegisterIgnoredAssemblies = new Func<Assembly, bool>[]
{ {
asm => !asm.FullName.StartsWith("Nancy.", StringComparison.InvariantCulture), asm => !asm.FullName.StartsWith("Nancy.", StringComparison.InvariantCulture),
}; };
/// <summary> /// <summary>
/// Gets the assemblies to ignore when autoregistering the application container /// Gets the assemblies to ignore when autoregistering the application container
/// Return true from the delegate to ignore that particular assembly, returning true /// Return true from the delegate to ignore that particular assembly, returning false
/// does not mean the assembly *will* be included, a false from another delegate will /// does not mean the assembly *will* be included, a true from another delegate will
/// take precedence. /// take precedence.
/// </summary> /// </summary>
protected virtual IEnumerable<Func<Assembly, bool>> AutoRegisterIgnoredAssemblies protected virtual IEnumerable<Func<Assembly, bool>> AutoRegisterIgnoredAssemblies
@ -49,11 +55,6 @@ namespace NzbDrone.Api
return this.ApplicationContainer.Resolve<INancyEngine>(); return this.ApplicationContainer.Resolve<INancyEngine>();
} }
/* protected override IModuleKeyGenerator GetModuleKeyGenerator()
{
return ApplicationContainer.Resolve<IModuleKeyGenerator>();
}*/
/// <summary> /// <summary>
/// Create a default, unconfigured, container /// Create a default, unconfigured, container
/// </summary> /// </summary>
@ -93,6 +94,7 @@ namespace NzbDrone.Api
break; break;
case Lifetime.PerRequest: case Lifetime.PerRequest:
throw new InvalidOperationException("Unable to directly register a per request lifetime."); throw new InvalidOperationException("Unable to directly register a per request lifetime.");
break;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
@ -104,10 +106,10 @@ namespace NzbDrone.Api
/// by IEnumerable{Type} constructor dependencies. /// by IEnumerable{Type} constructor dependencies.
/// </summary> /// </summary>
/// <param name="container">Container to register into</param> /// <param name="container">Container to register into</param>
/// <param name="collectionTypeRegistrationsn">Collection type registrations to register</param> /// <param name="collectionTypeRegistrations">Collection type registrations to register</param>
protected override sealed void RegisterCollectionTypes(TinyIoCContainer container, IEnumerable<CollectionTypeRegistration> collectionTypeRegistrationsn) protected override sealed void RegisterCollectionTypes(TinyIoCContainer container, IEnumerable<CollectionTypeRegistration> collectionTypeRegistrations)
{ {
foreach (var collectionTypeRegistration in collectionTypeRegistrationsn) foreach (var collectionTypeRegistration in collectionTypeRegistrations)
{ {
switch (collectionTypeRegistration.Lifetime) switch (collectionTypeRegistration.Lifetime)
{ {
@ -119,6 +121,7 @@ namespace NzbDrone.Api
break; break;
case Lifetime.PerRequest: case Lifetime.PerRequest:
throw new InvalidOperationException("Unable to directly register a per request lifetime."); throw new InvalidOperationException("Unable to directly register a per request lifetime.");
break;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
@ -160,8 +163,9 @@ namespace NzbDrone.Api
/// <summary> /// <summary>
/// Creates a per request child/nested container /// Creates a per request child/nested container
/// </summary> /// </summary>
/// <param name="context">Current context</param>
/// <returns>Request container instance</returns> /// <returns>Request container instance</returns>
protected override sealed TinyIoCContainer CreateRequestContainer() protected override TinyIoCContainer CreateRequestContainer(NancyContext context)
{ {
return this.ApplicationContainer.GetChildContainer(); return this.ApplicationContainer.GetChildContainer();
} }
@ -216,7 +220,7 @@ namespace NzbDrone.Api
} }
/// <summary> /// <summary>
/// Retreive a specific module instance from the container /// Retrieve a specific module instance from the container
/// </summary> /// </summary>
/// <param name="container">Container to use</param> /// <param name="container">Container to use</param>
/// <param name="moduleType">Type of the module</param> /// <param name="moduleType">Type of the module</param>

@ -2,9 +2,9 @@
<packages> <packages>
<package id="DDay.iCal" version="1.0.2.575" targetFramework="net40" /> <package id="DDay.iCal" version="1.0.2.575" targetFramework="net40" />
<package id="FluentValidation" version="6.2.1.0" targetFramework="net40" /> <package id="FluentValidation" version="6.2.1.0" targetFramework="net40" />
<package id="Nancy" version="0.23.2" targetFramework="net40" /> <package id="Nancy" version="1.4.3" targetFramework="net40" />
<package id="Nancy.Authentication.Basic" version="0.23.2" targetFramework="net40" /> <package id="Nancy.Authentication.Basic" version="1.4.1" targetFramework="net40" />
<package id="Nancy.Authentication.Forms" version="0.23.2" targetFramework="net40" /> <package id="Nancy.Authentication.Forms" version="1.4.1" targetFramework="net40" />
<package id="Newtonsoft.Json" version="6.0.6" targetFramework="net40" /> <package id="Newtonsoft.Json" version="6.0.6" targetFramework="net40" />
<package id="NLog" version="4.3.4" targetFramework="net40" /> <package id="NLog" version="4.3.4" targetFramework="net40" />
</packages> </packages>

@ -69,13 +69,13 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Owin.Hosting.2.1.0\lib\net40\Microsoft.Owin.Hosting.dll</HintPath> <HintPath>..\packages\Microsoft.Owin.Hosting.2.1.0\lib\net40\Microsoft.Owin.Hosting.dll</HintPath>
</Reference> </Reference>
<Reference Include="Nancy, Version=0.23.2.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Nancy, Version=1.4.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <HintPath>..\packages\Nancy.1.4.3\lib\net40\Nancy.dll</HintPath>
<HintPath>..\packages\Nancy.0.23.2\lib\net40\Nancy.dll</HintPath> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Nancy.Owin, Version=0.21.1.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Nancy.Owin, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <HintPath>..\packages\Nancy.Owin.1.4.1\lib\net40\Nancy.Owin.dll</HintPath>
<HintPath>..\packages\Nancy.Owin.0.23.2\lib\net40\Nancy.Owin.dll</HintPath> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>

@ -3,8 +3,8 @@
<package id="Microsoft.Owin" version="2.1.0" targetFramework="net40" /> <package id="Microsoft.Owin" version="2.1.0" targetFramework="net40" />
<package id="Microsoft.Owin.Host.HttpListener" version="2.1.0" targetFramework="net40" /> <package id="Microsoft.Owin.Host.HttpListener" version="2.1.0" targetFramework="net40" />
<package id="Microsoft.Owin.Hosting" version="2.1.0" targetFramework="net40" /> <package id="Microsoft.Owin.Hosting" version="2.1.0" targetFramework="net40" />
<package id="Nancy" version="0.23.2" targetFramework="net40" /> <package id="Nancy" version="1.4.3" targetFramework="net40" />
<package id="Nancy.Owin" version="0.23.2" targetFramework="net40" /> <package id="Nancy.Owin" version="1.4.1" targetFramework="net40" />
<package id="Newtonsoft.Json" version="6.0.6" targetFramework="net40" /> <package id="Newtonsoft.Json" version="6.0.6" targetFramework="net40" />
<package id="NLog" version="4.3.4" targetFramework="net40" /> <package id="NLog" version="4.3.4" targetFramework="net40" />
<package id="Owin" version="1.0" targetFramework="net40" /> <package id="Owin" version="1.0" targetFramework="net40" />

@ -64,13 +64,13 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Owin.Hosting.2.1.0\lib\net40\Microsoft.Owin.Hosting.dll</HintPath> <HintPath>..\packages\Microsoft.Owin.Hosting.2.1.0\lib\net40\Microsoft.Owin.Hosting.dll</HintPath>
</Reference> </Reference>
<Reference Include="Nancy, Version=0.23.2.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Nancy, Version=1.4.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <HintPath>..\packages\Nancy.1.4.3\lib\net40\Nancy.dll</HintPath>
<HintPath>..\packages\Nancy.0.23.2\lib\net40\Nancy.dll</HintPath> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Nancy.Owin, Version=0.23.2.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Nancy.Owin, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <HintPath>..\packages\Nancy.Owin.1.4.1\lib\net40\Nancy.Owin.dll</HintPath>
<HintPath>..\packages\Nancy.Owin.0.23.2\lib\net40\Nancy.Owin.dll</HintPath> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>

@ -7,8 +7,8 @@
<package id="Microsoft.Owin.Host.HttpListener" version="2.1.0" targetFramework="net40" /> <package id="Microsoft.Owin.Host.HttpListener" version="2.1.0" targetFramework="net40" />
<package id="Microsoft.Owin.Hosting" version="2.1.0" targetFramework="net40" /> <package id="Microsoft.Owin.Hosting" version="2.1.0" targetFramework="net40" />
<package id="Moq" version="4.0.10827" targetFramework="net40" /> <package id="Moq" version="4.0.10827" targetFramework="net40" />
<package id="Nancy" version="0.23.2" targetFramework="net40" /> <package id="Nancy" version="1.4.3" targetFramework="net40" />
<package id="Nancy.Owin" version="0.23.2" targetFramework="net40" /> <package id="Nancy.Owin" version="1.4.1" targetFramework="net40" />
<package id="Newtonsoft.Json" version="6.0.6" targetFramework="net40" /> <package id="Newtonsoft.Json" version="6.0.6" targetFramework="net40" />
<package id="NLog" version="4.3.4" targetFramework="net40" /> <package id="NLog" version="4.3.4" targetFramework="net40" />
<package id="NUnit" version="3.5.0" targetFramework="net40" /> <package id="NUnit" version="3.5.0" targetFramework="net40" />

Loading…
Cancel
Save