Updated MiniProfiler to v2

This commit is contained in:
Mark McDowall 2012-07-27 14:31:33 -07:00
commit 216bf08ced
16 changed files with 2407 additions and 123 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -2,15 +2,15 @@
using System.Web;
using System.Web.Mvc;
using System.Linq;
using MvcMiniProfiler;
using MvcMiniProfiler.MVCHelpers;
using StackExchange.Profiling;
using StackExchange.Profiling.MVCHelpers;
using Microsoft.Web.Infrastructure;
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
//using System.Data;
//using System.Data.Entity;
//using System.Data.Entity.Infrastructure;
//using MvcMiniProfiler.Data.EntityFramework;
//using MvcMiniProfiler.Data.Linq2Sql;
//using StackExchange.Profiling.Data.EntityFramework;
//using StackExchange.Profiling.Data.Linq2Sql;
[assembly: WebActivator.PreApplicationStartMethod(
typeof($rootnamespace$.App_Start.MiniProfilerPackage), "PreStart")]
@ -29,11 +29,11 @@ namespace $rootnamespace$.App_Start
// Be sure to restart you ASP.NET Developement server, this code will not run until you do that.
//TODO: See - _MINIPROFILER UPDATED Layout.cshtml
// For profiling to display in the UI you will have to include the line @MvcMiniProfiler.MiniProfiler.RenderIncludes()
// For profiling to display in the UI you will have to include the line @StackExchange.Profiling.MiniProfiler.RenderIncludes()
// in your master layout
//TODO: Non SQL Server based installs can use other formatters like: new MvcMiniProfiler.SqlFormatters.InlineFormatter()
MiniProfiler.Settings.SqlFormatter = new MvcMiniProfiler.SqlFormatters.SqlServerFormatter();
//TODO: Non SQL Server based installs can use other formatters like: new StackExchange.Profiling.SqlFormatters.InlineFormatter()
MiniProfiler.Settings.SqlFormatter = new StackExchange.Profiling.SqlFormatters.SqlServerFormatter();
//TODO: To profile a standard DbConnection:
// var profiled = new ProfiledDbConnection(cnn, MiniProfiler.Current);
@ -46,6 +46,20 @@ namespace $rootnamespace$.App_Start
//Setup profiler for Controllers via a Global ActionFilter
GlobalFilters.Filters.Add(new ProfilingActionFilter());
// You can use this to check if a request is allowed to view results
//MiniProfiler.Settings.Results_Authorize = (request) =>
//{
// you should implement this if you need to restrict visibility of profiling on a per request basis
// return !DisableProfilingResults;
//};
// the list of all sessions in the store is restricted by default, you must return true to alllow it
//MiniProfiler.Settings.Results_List_Authorize = (request) =>
//{
// you may implement this if you need to restrict visibility of profiling lists on a per request basis
//return true; // all requests are kosher
//};
}
public static void PostStart()
@ -80,7 +94,7 @@ namespace $rootnamespace$.App_Start
{
if (!CurrentUserIsAllowedToSeeProfiler())
{
MvcMiniProfiler.MiniProfiler.Stop(discardResults: true);
StackExchange.Profiling.MiniProfiler.Stop(discardResults: true);
}
};
*/

View file

@ -1,16 +1,20 @@
<!DOCTYPE html>
@* Required so you have extention methods for client timings *@
@using StackExchange.Profiling;
<!DOCTYPE html>
<html>
<head>
@* optional (enable client timing framework) *@
@this.InitClientTimings()
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
@* Make sure you've added this one line to your LAYOUT or MASTER PAGE *@
@MvcMiniProfiler.MiniProfiler.RenderIncludes()
@* optional time scripts in the header *@
@this.TimeScript("Content Site.css",
@<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />)
@this.TimeScript("jQuery 1.5.1",
@<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>)
@this.TimeScript("modernizr",
@<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>)
</head>
<body>
@ -35,5 +39,7 @@
<footer>
</footer>
</div>
@* Make sure you've added this one line to your LAYOUT or MASTER PAGE *@
@MiniProfiler.RenderIncludes()
</body>
</html>

Binary file not shown.