Created
September 14, 2012 14:55
-
-
Save prabirshrestha/3722413 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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