Different View Engine for Portable Area

419 views Asked by At

I'm using ASP.NET MVC 2 and MvcContrib 2 portable areas. The consuming application 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 ?

1

There are 1 answers

1
Shashi Penumarthy On

(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