How can Orchard leave without calling RenderBody?
Ive analyzed the rendering and rendering engine of Orchard CMS to understand how it is combined. I found that neither RenderBody nor RenderSection is ever named. I understand that the Razor view engine requires calling one or the other.
What's going on around the requirement that RenderBody or RenderSection should be called, or is an exception thrown by Razor?
Is it the fact that theres a custom view engine (ThemeAwareViewEngine)? If so, how does it handle parsing Razor syntax for content creation?
Thank.
source to share
In fact, the opposite is true. Razor
itself does not require that it be RenderBody
named RazorViewEngine
that has this requirement. There could definitely be a different view engine that Razor uses that has a completely different way of working. Take a look at https://github.com/Antaris/RazorEngine or https://github.com/Buildstarted/RazorSharp I've also written a markdown viewer that uses a razor for some simple layouts.
From reading the source, it appears that they have created several custom viewers. They are RazorViewEngine
replaced by a base class for razor-generated files of its own WebViewPage
, which has a method Display
for which it Zone
is an alias. This is what allows them to display child views, it looks like LayoutAwareViewEngine
there are several types of zones such as DocumentZone
, ContentZone
etc.
So in the end they made a lot of custom code.
source to share