toddams/RazorLight

_ViewStart support

Opened this issue · 1 comments

Is your feature request related to a problem? Please describe.

I need to share ViewBag properties across templates.

Describe the solution you'd like

I like to define those properties once in a _ViewStart.cshtml file:

@{
  ViewBag.GlobalVariable = 42;
}

And use the GlobalVariable in my templates:

@model object

@ViewBag.GlobalVariable

Additional context

Seems like ViewStart-related code is commented in TemplateRenderer.

Currently using RazorLight 2.0.0-rc.3.