天道酬勤,学无止境

mvc-mini-profiler

Using mvc-mini-profiler with EF 4.0 and Ninject

I'm trying to use the new mvc-mini-profiler with my EF4 based app, but I have no idea how to properly get a connection to my destination datasource. Here's as far as I have gotten. Func<IMyContainer> createContainer = () => { var profiler = MiniProfiler.Current; if (profiler != null) { var rootConn = // ???? var conn = ProfiledDbConnection.Get(rootConn); return ObjectContextUtils.CreateObjectContext<MyContainer>(conn); } else { return new MyContainer(); } }; kernel.Bind<IMyContainer>().ToMethod(ctx => createContainer()).InRequestScope(); How do I get a connection to an EF container, without

2021-11-28 07:20:07    分类:问答    asp.net-mvc-3   entity-framework-4   ninject   mvc-mini-profiler

MiniProfiler 没有出现在 asp.net MVC 上(MiniProfiler not showing up on asp.net MVC)

问题 我将此添加到我的 Global.asax.cs 中: protected void Application_BeginRequest() { if (Request.IsLocal) { MiniProfiler.Start(); } } protected void Application_EndRequest() { MiniProfiler.Stop(); } 我加了 @MiniProfiler.RenderIncludes() 就在 _Layout.cshtml 中的</body>标记下方。 在我的控制器中,我使用: public class HomeController : Controller { public ActionResult Index() { var profiler = MiniProfiler.Current; // it's ok if this is null using (profiler.Step("Set page title")) { ViewBag.Title = "Home Page"; } using (profiler.Step("Doing complex stuff")) { using (profiler.Step("Step A")) { // something more interesting here

2021-11-27 06:17:13    分类:技术分享    c#   asp.net-mvc   profiler   mvc-mini-profiler

ASP.NET 网站的迷你配置文件(Miniprofiler for ASP.NET web site)

问题 如何在 asp.net 网站(不适用于 MVC)中使用 miniprofiler? MVC 有很多资源,但我在网站上找不到任何内容。 感谢亚历克斯。 现在它适用于 asp.net 网站。 但我无法理解它显示的内容。 我没有在方法中编写任何代码。 见下图。 代码如下,我运行了分析器。 protected void Page_Load(object sender, EventArgs e) { using (MiniProfiler.Current.Step("test")) { Page.Title = "12345"; } } 回答1 来自 miniprofiler.com: PM> 安装包 MiniProfiler 在您的global.asax : using StackExchange.Profiling; ... protected void Application_BeginRequest() { if (Request.IsLocal) { MiniProfiler.Start(); } } protected void Application_EndRequest() { MiniProfiler.Stop(); } 然后在您的母版页中的某处: <%= StackExchange.Profiling.MiniProfiler.RenderIncludes() %>

2021-11-26 08:21:17    分类:技术分享    asp.net   web   mvc-mini-profiler

MiniProfilerEF.Initialize() could not be initialized properly

I just started trying out the mvc-mini-profiler in my MVC3 project with EF4.1 and after changing MiniProfilerEF.Initialize(); to MiniProfilerEF.Initialize_EF42(); I'm getting : A null was returned after calling the 'GetService' method on a store provider instance of type 'MvcMiniProfiler.Data.EFProfiledOdbcProviderFactory'. The store provider might not be functioning correctly. This method MiniProfilerEF.Initialize(); - was giving me The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) So I've replaced dll's with ones I've manually built from the source. What

2021-11-25 01:40:00    分类:问答    asp.net-mvc-3   entity-framework   mvc-mini-profiler

Slow EF profiling performance with mvc-mini-profiler

When I create my context using the below function the profiler shows about a 300ms increase from the standard EF (version 4) context creation method. Is there another way to do this that has better performance? It defeats the purpose of performance profiling as is. public static Models.MyEntities GetContext() { var profiler = MiniProfiler.Current; var sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnString"].ConnectionString); var profiledConnection = MvcMiniProfiler.Data.ProfiledDbConnection.Get(sqlConn, profiler); return ObjectContextUtils.CreateObjectContext<Models

2021-11-22 00:33:23    分类:问答    entity-framework   asp.net-mvc-3   profiling   mvc-mini-profiler

Miniprofiler for ASP.NET web site

How can I use miniprofiler in asp.net web site(NOT FOR MVC)? There are many resources for MVC but I can not find anything for web site. Thanks to Alex. Now it works for asp.net web site. But I can not understand what it displays. I have not written any code in method. See the image below. Code is as below for which I ran profiler. protected void Page_Load(object sender, EventArgs e) { using (MiniProfiler.Current.Step("test")) { Page.Title = "12345"; } }

2021-11-19 07:11:35    分类:问答    asp.net   web   mvc-mini-profiler

MiniProfiler not showing up on asp.net MVC

I added this to my Global.asax.cs: protected void Application_BeginRequest() { if (Request.IsLocal) { MiniProfiler.Start(); } } protected void Application_EndRequest() { MiniProfiler.Stop(); } I added @MiniProfiler.RenderIncludes() just below the </body> tag in _Layout.cshtml. In my controller I'm using: public class HomeController : Controller { public ActionResult Index() { var profiler = MiniProfiler.Current; // it's ok if this is null using (profiler.Step("Set page title")) { ViewBag.Title = "Home Page"; } using (profiler.Step("Doing complex stuff")) { using (profiler.Step("Step A")) { //

2021-11-19 03:46:58    分类:问答    c#   asp.net-mvc   profiler   mvc-mini-profiler

Mini MVC profiler: appears to be displaying profile times for every static resource

I've just started using the mvc-mini-profiler (http://code.google.com/p/mvc-mini-profiler/) and I think it's awesome. However, I'm getting some odd behaviour while using it. I've got an ASP.NET Webforms site running on IIS7.5 and for some reason when I load a page with the profiler enabled, I not only get a time measurement for the aspx page, but I also get it for random css and js resources on the page. The aspx profile works correctly, with the SQL query also being profiled correctly. However, as the picture shows I also get a bunch of other results which appear to be results for static CSS

2021-11-19 02:55:54    分类:问答    c#   asp.net   mvc-mini-profiler

mvc 迷你分析器 - IIS7 问题(mvc mini profiler - IIS7 issue)

问题 类似于这个问题 mvc mini profiler (1.4) & IIS 我正在运行 IIS 7.5,我的应用程序池在 Webforms 站点上以集成模式运行 当对 mini-profiler-includes 文件的请求发生时,我收到一堆 404 错误? 我唯一改变的是我删除了 MVChelpers 文件夹和 MVC 引用,因为我们没有在我们的站点上安装它们。 它从 VS2010 运行良好 任何想法我需要做什么来解决这个问题? 谢谢 回答1 谷歌知道一切......有时我只需要深入挖掘一点我想 无论如何,如果您遇到此问题,请尝试将其添加到您的 web.config <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> 为我工作。

2021-10-31 08:55:25    分类:技术分享    asp.net   iis-7   iis-7.5   mvc-mini-profiler

在 Entity Framework code-first 和 ASP.NET MVC 3 和 mvc miniprofiler 中使用 SQL Server CE 的问题(Problem using SQL Server CE with Entity Framework code-first and ASP.NET MVC 3 and mvc miniprofiler)

问题 我正在尝试使用 C#、Entity Framework 4.0 代码优先和 SQL Server CE 以及自动脚手架创建 ASP.NET MVC 3 应用程序。 一切正常,直到我尝试实际使用连接到 SQL Server CE 数据库的页面。 我在 web.config 中的连接是这样的 <add name="BRX" connectionString="Data Source=|DataDirectory|BRX.sdf" providerName="System.Data.SqlServerCe.4.0"/> 我的模型类看起来像这样 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ComponentModel.DataAnnotations; namespace BizRadioXInternal.Models { public class KeyWordEmail { [Key] public int KeywordEmailID { get; set; } public string Name { get; set; } public string Keyword { get; set; } public string

2021-10-31 06:29:50    分类:技术分享    asp.net-mvc-3   entity-framework-4   sql-server-ce   mvc-mini-profiler   asp.net-mvc-scaffolding