Why no call to RenderBody?

Topics: Core, General
Mar 22, 2012 at 4:01 PM
Edited Mar 22, 2012 at 4:01 PM


I’ve been dissecting the rendering and view engine in an effort to understand how it’s put together. I have discovered that neither RenderBody nor RenderSection are ever called. It is my understanding that the Razor view engine requires a call to one or the other.

What is it that gets around the requirement that RenderBody or RenderSection have to be called or an exception is thrown by Razor?

Is it the fact that there’s a custom view engine (ThemeAwareViewEngine)? If so, how does it handle parsing Razor syntax to generate the content?

Thank you.

Mar 23, 2012 at 12:09 AM
Edited Mar 23, 2012 at 12:10 AM

If I'm not mistaken, you only call RenderBody from within a view that is used as the Layout for another view.
In Orchard, that system is afaik not used. Instead, it builds up a tree of shapes, which get rendered. So at the root of it all we have the Layout shape, which has a collection of Zone shapes, each in turn having shapes generated by content drivers, shape table providers, other views, etc.

You'd have to verify with the source though if you want to be certain on how it's done.