I need some convincing on the Razor View Engine.
From what I can tell, Microsoft have simply re-introduced inline code back into markup; weren't code-behind pages originally introduced to eradicate this?
I assume (and hope) that I am missing something :)
Razor is not for writing your business logic in your view. Razor is for iterating over model and converting it to html. Your business logic is in controller besides even in WebForms view engine you did the same looping only with a more verbose syntax. Razor has cleaner syntax. It doesn't bring anything else with it.
razor is best used with MVC. Yes it does reintroduce inline code. but it is about separation of code.
Your razor code should not have any logic in it. It really should be used to simply get your data onto a page (small amounts of logic e.g If Data= True THen Should this section, are ok tho)
but all business logic is still in your controller/codebehind
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With