Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • woo123 3 posts 24 karma points
    Jul 22, 2011 @ 23:44
    woo123
    0

    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

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Jul 23, 2011 @ 14:43
    Bo Damgaard Mortensen
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft