Different View Engine for Portable Area
I'm using ASP.NET MVC 2 and MvcContrib 2 portable areas. The consuming appl开发者_运维技巧ication is leveraging a CustomWebFormViewEngine which is derived from the standard WebForm view engine. I want the portable area "Foo" to utilize the standard portable area embedded view engine. How do I go about doing this, without affecting the consuming application?
The consuming app is doing this:
ViewEngines.Engines.Add(new CustomWebFormViewEngine()));
I can NOT do something like the following in the portable area, since that will clear off the CustomWebFormViewEngine from the consuming application:
ViewEngines.Clear();
ViewEngines.Engines.Add(new WebFormViewEngine()));
So how do I get it so that a given portable area leverages the embedded view engine, but the rest of the application continues to use the CustomWebFormViewEngine ?
(sorry I don't have enough rep to comment)
Can you use a different file extension for different views and then specify that in the ViewLocationFormat property of your view engine definition? For example, you can end all views that use the custom view engine definition with '.cve' Or have I misunderstood the question?
http://msdn.microsoft.com/en-us/library/dd492273.aspx
http://www.singingeels.com/Articles/Creating_a_Custom_View_Engine_in_ASPNET_MVC.aspx
精彩评论