Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
Created September 14, 2012 14:55
Show Gist options
  • Save prabirshrestha/3722413 to your computer and use it in GitHub Desktop.
Save prabirshrestha/3722413 to your computer and use it in GitHub Desktop.
namespace Nancy.Hosting.Owin
{
using System;
using Nancy.Bootstrapper;
class NancyOwinEngineWrapper : INancyEngine
{
private readonly INancyEngine engine;
private readonly Action<NancyContext> contextCallback;
public NancyOwinEngineWrapper(INancyEngine engine, Action<NancyContext> contextCallback)
{
this.engine = engine;
this.contextCallback = contextCallback;
}
public Func<NancyContext, IPipelines> RequestPipelinesFactory
{
get
{
return context =>
{
this.contextCallback(context);
return this.engine.RequestPipelinesFactory(context);
};
}
set { this.engine.RequestPipelinesFactory = value; }
}
public NancyContext HandleRequest(Request request)
{
return this.engine.HandleRequest(request);
}
public void HandleRequest(Request request, Action<NancyContext> onComplete, Action<Exception> onError)
{
this.engine.HandleRequest(request, onComplete, onError);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment