-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ViewEngine requires more context, specifically the actual controller that handled the request. #787
Comments
I'd change the bug title to something more specific. There's tons of breaking changes. |
Remnant from an earlier design where the RazorViewEngine didn't depend on Mvc.Core. There's no good reason for it not have the ActionContext (which is a direct substitute for ControllerContext) any more. |
pranavkm, can I read into your statement that I can count on a change in IViewEngine.
A good reason to do this is that;
I would really like to get a nod on this direction so that at least I can change the code myself and continue with my research in how a plugin architecture on top of this new design is going to work. I want to be ready to go day one when you guys release this thing. |
I changed the my local copy of the code to the following;
The fixup was very small and the MvcSample.Web works. Hope this helps. |
There are a few things to consider here:
@lodejard we are interested in your feedback here, @pranavkm will stop in person. Overall I think the design suggested here and in #802 is fine. |
Yishai, Thanks for the change. My head is still stuck a bit in the previous MVC designs. When I said Controller, I really meant what "Assembly" originated this action. For all my cases that was the controller. I look forward to seeing the alternatives to having a controller, but the same applies..what "Assembly" originated that action. MVC5: My plugin design had the assembly and content in a version-ed folder, so I needed to know the assembly to find what versioned folder. I then fixed up the search paths in my inherited version of the RazorViewEngine. i.e. /Plugins/myArea.1.0.0.34/Area/{2}/Views/{1}/{0}, etc MVC6: I see pulling the versioned folder concept forward BTW: You guys are a bit heavy handed with the internal/private in the new RazorViewEngine. Not much I can do now by inheriting from it. If I can't inherit, I guess I have to copy it, which is too bad as 99% is unchanged. There are a lot of great generic helper classes I have seen in the framework, all marked as internal..Argh. My WOW moment was when I did the following;
|
@ghstahl We'd love to hear from you about specific things that can be improved or made more reusable (including RazorViewEngine). Open bugs telling us what you're trying to accomplish and why it's hard. |
My need: I need to know know what controller handled the request from within the ViewEngine.
in MVC 5
Notice the ControllerContext.
in MVC 6 a ViewEngine inherits from IViewEngine, which has no concept of the real controller.
Questions:
I simply fix up the search paths in my view engine to only look in the proper directories.
\plugins\SomeArea.1.0.0.34\Views\
I would argue that the view engines need as much context information that you can give them.
I traced the problem to the ViewResult class, where;
ActionContext context, would be fantastic to have passed in when you call FindView, instead of cherry picking context.RouteData.Values. Pass the entire context in please.
Thanks
The text was updated successfully, but these errors were encountered: