Created
March 5, 2012 11:33
-
-
Save ioleksiy/1977951 to your computer and use it in GitHub Desktop.
Using MvcMiniProfiler with NancyFX
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
| public class CustomBootstrapper : DefaultNancyBootstrapper | |
| { | |
| protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) | |
| { | |
| base.ApplicationStartup(container, pipelines); | |
| pipelines.BeforeRequest += PreRequest; | |
| pipelines.AfterRequest += PostRequest; | |
| } | |
| private static Response PreRequest(NancyContext ctx) | |
| { | |
| MiniProfiler.Start(); | |
| } | |
| private static void PostRequest(NancyContext ctx) | |
| { | |
| MiniProfiler.Stop(); | |
| } | |
| } |
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
| public class ExampleModule : NancyModule | |
| { | |
| public ExampleModule() | |
| { | |
| Get["/"] = IndexFunc; | |
| } | |
| private Response IndexFunc(dynamic param) | |
| { | |
| var profiler = MiniProfiler.Current; | |
| using (profiler.Step("Indexing")) | |
| { | |
| // Some code here for index measure | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The article http://www.oleksiy.pro/2012/03/05/using-mvcminiprofiler-with-nancyfx/