Skip to content

Instantly share code, notes, and snippets.

@Zoxive
Created May 13, 2018 15:36
Show Gist options
  • Save Zoxive/b908070af8fce39e165389d2b1ec7a31 to your computer and use it in GitHub Desktop.
Save Zoxive/b908070af8fce39e165389d2b1ec7a31 to your computer and use it in GitHub Desktop.
Mini Profile dotnet core razor view engine
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