Created
May 13, 2018 15:36
-
-
Save Zoxive/b908070af8fce39e165389d2b1ec7a31 to your computer and use it in GitHub Desktop.
Mini Profile dotnet core razor view engine
This file contains 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 ProfiledViewResultExecutor : IActionResultExecutor<ViewResult> | |
{ | |
private readonly IActionResultExecutor<ViewResult> _base; | |
public ProfiledViewResultExecutor(IActionResultExecutor<ViewResult> @base) | |
{ | |
_base = @base; | |
} | |
public Task ExecuteAsync(ActionContext context, ViewResult result) | |
{ | |
using (MiniProfiler.Current.Step($"ExecuteView {result.ViewName}")) | |
{ | |
return _base.ExecuteAsync(context, result); | |
} | |
} | |
} | |
// Register by wrapping the original implementation | |
// services.WrapSingleton<IActionResultExecutor<ViewResult>>((@base, ioc) => new ProfiledViewResultExecutor(@base)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment