Order the pipeline registration process.
This commit is contained in:
parent
a2536deef0
commit
19aded7a15
|
@ -27,6 +27,8 @@ namespace NzbDrone.Api.Authentication
|
|||
_configFileProvider = configFileProvider;
|
||||
}
|
||||
|
||||
public int Order { get { return 10; } }
|
||||
|
||||
public void Register(IPipelines pipelines)
|
||||
{
|
||||
if (_configFileProvider.AuthenticationMethod == AuthenticationType.Forms)
|
||||
|
|
|
@ -14,6 +14,8 @@ namespace NzbDrone.Api.Extensions.Pipelines
|
|||
_cacheableSpecification = cacheableSpecification;
|
||||
}
|
||||
|
||||
public int Order { get { return 0; } }
|
||||
|
||||
public void Register(IPipelines pipelines)
|
||||
{
|
||||
pipelines.AfterRequest.AddItemToStartOfPipeline((Action<NancyContext>) Handle);
|
||||
|
|
|
@ -7,6 +7,8 @@ namespace NzbDrone.Api.Extensions.Pipelines
|
|||
{
|
||||
public class CorsPipeline : IRegisterNancyPipeline
|
||||
{
|
||||
public int Order { get { return 0; } }
|
||||
|
||||
public void Register(IPipelines pipelines)
|
||||
{
|
||||
pipelines.AfterRequest.AddItemToEndOfPipeline((Action<NancyContext>) Handle);
|
||||
|
|
|
@ -12,6 +12,8 @@ namespace NzbDrone.Api.Extensions.Pipelines
|
|||
{
|
||||
private readonly Logger _logger;
|
||||
|
||||
public int Order { get { return 0; } }
|
||||
|
||||
public GzipCompressionPipeline(Logger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
|
|
|
@ -4,6 +4,8 @@ namespace NzbDrone.Api.Extensions.Pipelines
|
|||
{
|
||||
public interface IRegisterNancyPipeline
|
||||
{
|
||||
int Order { get; }
|
||||
|
||||
void Register(IPipelines pipelines);
|
||||
}
|
||||
}
|
|
@ -14,6 +14,8 @@ namespace NzbDrone.Api.Extensions.Pipelines
|
|||
_cacheableSpecification = cacheableSpecification;
|
||||
}
|
||||
|
||||
public int Order { get { return 0; } }
|
||||
|
||||
public void Register(IPipelines pipelines)
|
||||
{
|
||||
pipelines.BeforeRequest.AddItemToStartOfPipeline((Func<NancyContext, Response>) Handle);
|
||||
|
|
|
@ -7,6 +7,8 @@ namespace NzbDrone.Api.Extensions.Pipelines
|
|||
{
|
||||
public class NzbDroneVersionPipeline : IRegisterNancyPipeline
|
||||
{
|
||||
public int Order { get { return 0; } }
|
||||
|
||||
public void Register(IPipelines pipelines)
|
||||
{
|
||||
pipelines.AfterRequest.AddItemToStartOfPipeline((Action<NancyContext>) Handle);
|
||||
|
|
|
@ -14,6 +14,8 @@ namespace NzbDrone.Api.Extensions.Pipelines
|
|||
|
||||
private static int _requestSequenceID;
|
||||
|
||||
public int Order { get { return 100; } }
|
||||
|
||||
public void Register(IPipelines pipelines)
|
||||
{
|
||||
pipelines.BeforeRequest.AddItemToStartOfPipeline(LogStart);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
using NLog;
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
using Nancy.Bootstrapper;
|
||||
using Nancy.Diagnostics;
|
||||
using NLog;
|
||||
using NzbDrone.Api.ErrorManagement;
|
||||
using NzbDrone.Api.Extensions.Pipelines;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
|
@ -43,7 +44,7 @@ namespace NzbDrone.Api
|
|||
|
||||
private void RegisterPipelines(IPipelines pipelines)
|
||||
{
|
||||
var pipelineRegistrars = _tinyIoCContainer.ResolveAll<IRegisterNancyPipeline>();
|
||||
var pipelineRegistrars = _tinyIoCContainer.ResolveAll<IRegisterNancyPipeline>().OrderBy(v => v.Order).ToList();
|
||||
|
||||
foreach (var registerNancyPipeline in pipelineRegistrars)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue