开发者

how to use MvcMiniProfiler with MvcTurbine?

开发者 https://www.devze.com 2023-03-30 21:27 出处:网络
I am using MvcTurbine which automatically wires up the IViewEngines from your project and I recently added MvcMiniProfiler and am trying to get it to work the only problem is that the MvcMiniProfiler

I am using MvcTurbine which automatically wires up the IViewEngines from your project and I recently added MvcMiniProfiler and am trying to get it to work the only problem is that the MvcMiniProfiler has a ProfilingViewEngine which requir开发者_Go百科es a constructor argument for IViewEngine so it creates a Bidirectional Dependancy in Structuremap. Below is the error

StructureMap Exception Code:  295
Bidirectional Dependency Problem detected with RequestedType: 
System.Web.Mvc.IViewEngine, Name: a8cb1f76-6ff5-4702-9e7a-3200703dd519, ConcreteType: MvcMiniProfiler.MVCHelpers.ProfilingViewEngine.  
The BuildStack is:
1.) RequestedType: System.Web.Mvc.IViewEngine, Name: a8cb1f76-6ff5-4702-9e7a-3200703dd519, ConcreteType: MvcMiniProfiler.MVCHelpers.ProfilingViewEngine

How do you ignore or manually register IViewEngines with MvcTurbine?


I was able to get this to work by overriding the IViewEngine registration process and explicitly set a single IViewEngine implementation.

In my global.asax, I added the following:

Engine.Initialize.DisableViewEngineRegistration(); ViewEngines.Engines.Add(new RazorViewEngine()); MiniProfilerEF.Initialize();

This forced MvcTurbine to use the razor view engine, which the MvcMiniProfiler could override without error.

I hope that this helps after so long. If not for you, then maybe for others like myself that found your question as the only resource on this issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消