Hans Karlsen (talk | contribs) (Created page with "MDriven Turnkey does a lot to get a seamless environment for application development. If you would like to make use of parts of the functionality and render a specific viewmo...") |
Hans Karlsen (talk | contribs) No edit summary |
||
Line 4: | Line 4: | ||
This is how turnkey does it internally: | This is how turnkey does it internally: | ||
<nowiki> | |||
internal static class MvcRazorPartialViewShared | |||
{ | |||
internal static string RenderRazorPartial(ViewModel.Runtime.ViewModel viewModel) | |||
{ | |||
StringBuilder sb = new StringBuilder(2048); // Building big things! | |||
// IMPORTANT! The Using and statements should match the one in the main page! | |||
sb.AppendLine("@using Eco.ViewModel.Runtime"); | |||
sb.AppendLine("@using Eco.MVC"); | |||
sb.AppendLine("@using StreamingAppGenericAPIAndControllers"); | |||
sb.AppendLine("@model VMClass"); | |||
RazorControlRenderer razorRenderer = new RazorControlRenderer(); | |||
if (RenderSettings.CheckUseCSSGrid(viewModel)) | |||
{ | |||
CSSGridViewUICreator cssGridViewCreator = new CSSGridViewUICreator(razorRenderer, sb); | |||
ViewModelRTCreator.CreateDataAndUI(null, cssGridViewCreator, viewModel); | |||
} | |||
else | |||
{ | |||
BootstrapViewUICreator bootstrapViewCreator = new BootstrapViewUICreator(razorRenderer, sb); | |||
ViewModelRTCreator.CreateDataAndUI(null, bootstrapViewCreator, viewModel); // Create UI delegating work to UICreator | |||
} | |||
return sb.ToString(); | |||
} | |||
} | |||
</nowiki> |
Revision as of 12:32, 22 April 2019
MDriven Turnkey does a lot to get a seamless environment for application development.
If you would like to make use of parts of the functionality and render a specific viewmodel you can do so.
This is how turnkey does it internally: internal static class MvcRazorPartialViewShared { internal static string RenderRazorPartial(ViewModel.Runtime.ViewModel viewModel) { StringBuilder sb = new StringBuilder(2048); // Building big things! // IMPORTANT! The Using and statements should match the one in the main page! sb.AppendLine("@using Eco.ViewModel.Runtime"); sb.AppendLine("@using Eco.MVC"); sb.AppendLine("@using StreamingAppGenericAPIAndControllers"); sb.AppendLine("@model VMClass"); RazorControlRenderer razorRenderer = new RazorControlRenderer(); if (RenderSettings.CheckUseCSSGrid(viewModel)) { CSSGridViewUICreator cssGridViewCreator = new CSSGridViewUICreator(razorRenderer, sb); ViewModelRTCreator.CreateDataAndUI(null, cssGridViewCreator, viewModel); } else { BootstrapViewUICreator bootstrapViewCreator = new BootstrapViewUICreator(razorRenderer, sb); ViewModelRTCreator.CreateDataAndUI(null, bootstrapViewCreator, viewModel); // Create UI delegating work to UICreator } return sb.ToString(); } }