I'm writing a ReactJs application with jspm and a lot of my views end up looking like this

<script>System.import('customers')</script>

or

<script>System.import('invoicing')</script>

so what gets sent to the browser is the _Layout.cshtml (as defined by _ViewStart.cshtml`) and that simple body.

Since there's literally no variance here, I'd like to not have to create the view file at all (there's additional reasons for this as well). I'd like to be able to do

return new LoadJsModuleResult('customers');

or

return new LoadJsModuleResult('invoicing');

How would I go about writing LoadJsModuleResult?

I'm looking at the source for ViewResult and ViewEngineResult but it seems that at that point everything is already assembled with the assembly happening somewhere in ViewEngineCollection. I can track it as far as BuildManagerWrapper.GetCompiledType but then we get into the depths of System.Web.

Does anyone have any hints?

  • I'll note that convenience is not the only reason I want to do this, I'm also making a module system that this would work particularly well with.

Related posts

Recent Viewed