You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So it's clear from the start, I'm not using this to generate HTML. (Just to point out that while it might not be the best for HTML generation, for what I'm doing this is quite essential!)
Does anyone have a suggestion on how to reuse functions defined in one template? In MVC4 I think you could via the AppData folder.
Looking at the .dll thats compiled, there is a ExecuteAsync(). You can see references to the @'model' as well. But not the functions defined within the 'cshtml'. I think this is because the functions are embedded private functions within ExecuteAsync().
I don't suppose there is a cunning way to make those public, and therefore re-usable?
This is what I see in dotPeek: (For example if I wanted to 'expose' SetColour(). )
publicclassTemplate:RazorModel{publicvirtualasyncTaskExecuteAsync(){// snipSetColour(Color.DarkOrchid);SetColour(Color.White);// snipvoidSetColour(Colorcolour){// do something}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
So it's clear from the start, I'm not using this to generate HTML. (Just to point out that while it might not be the best for HTML generation, for what I'm doing this is quite essential!)
Does anyone have a suggestion on how to reuse functions defined in one template? In MVC4 I think you could via the AppData folder.
Looking at the .dll thats compiled, there is a ExecuteAsync(). You can see references to the @'model' as well. But not the functions defined within the 'cshtml'. I think this is because the functions are embedded private functions within ExecuteAsync().
I don't suppose there is a cunning way to make those public, and therefore re-usable?
This is what I see in dotPeek: (For example if I wanted to 'expose' SetColour(). )
Beta Was this translation helpful? Give feedback.
All reactions