My intension is to move all the page logic to Razor scripts. That means I'll only have simple page as a “container” and html content will be delivered thought Razor for each page.
Are there any drawbacks for this solution except difficulty maintenance? What about performance?
I'd say it's all about personal preference. Although there's a few factors to keep in mind when moving all HTML content into Razor macros:
1) If you have frontend devs/designers on the project, they'll have to access the Razor file to set up styles and such, whereas they can just access the markup from the template, leaving your precious Razor code for itself ;-)
2) Generally speaking I would think of seperations of concerns and place markup in the templates and keep the markup to a minimum in the razor/xslt files.
I don't know about performance, if anything, the less code/markup the macro has to punch the more performance. A shot in the dark really, because honestly I don't think there's much of a drawback to it when it comes to performance. Would be cool if someone with more knowledge could clearify this
All in all, I would say: keep the logic where it should be and the markup where it should be - alas in the templates ;-) But that's just the way I like to work.
moving page logic into Razor?
Guys, I need an architectural advice.
My intension is to move all the page logic to Razor scripts. That means I'll only have simple page as a “container” and html content will be delivered thought Razor for each page.
Are there any drawbacks for this solution except difficulty maintenance? What about performance?
Many thanks for your opinion
David
Hi David,
I'd say it's all about personal preference. Although there's a few factors to keep in mind when moving all HTML content into Razor macros:
1) If you have frontend devs/designers on the project, they'll have to access the Razor file to set up styles and such, whereas they can just access the markup from the template, leaving your precious Razor code for itself ;-)
2) Generally speaking I would think of seperations of concerns and place markup in the templates and keep the markup to a minimum in the razor/xslt files.
I don't know about performance, if anything, the less code/markup the macro has to punch the more performance. A shot in the dark really, because honestly I don't think there's much of a drawback to it when it comes to performance. Would be cool if someone with more knowledge could clearify this
All in all, I would say: keep the logic where it should be and the markup where it should be - alas in the templates ;-) But that's just the way I like to work.
Hope it makes sense.
All the best,
Bo
is working on a reply...