I would like to use the MiniProfiler for my MVC3 application, so I followed Scott Hanselman's blog post
My Global.asax.cs file has the necessary changes like in the source's MVC sample.
But I would like to measure a particular call in my controller. So I put this code in controller:
if (Request.IsLocal)
{
var profiler = MiniProfiler.Current;
using (profiler.Step("SelectUserDetail Function"))
{
user = UserService.SelectUserDetail(userId);
}
}
I suspect my code will never in production environment as I'm wrapping this block in a Request.IsLocal
check.
How can I do this check for only for local call or if I run in debug mode? At any case, it should execute the user = UserService.SelectUserDetail(userId)
statement.