Razor is the new view engine that ships with MVC 3. Scott Guthrie talked a lot about Razor for MVC3. He mentionned that Razor would be available for webforms as well, but later...
>>>>>>>>> Its a sad day for us WebForms developers that such a thing wont exist there or so I think because you havent talked about that in the post atleast,so how can we use it in Web Forms?
You'll be able to use .cshtml/.vbhtml files within web forms based applications as well. Stay tuned.
Hope this helps,
Scott (http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx)
Well, the Umbraco team did a fantastic job for integrating Razor in our favorite webforms CMS. The team did it well before S. Guthrie blog about it ;o)
In short: Well done!
One question: I love Xslt. I am wondering if they are scenario where Xslt is more appropriate than using Razor. Xslt is not a programming language while you can take advantage of C# when using Razor (Well Xslt has Xslt extensions).
A part from the comfort of having several options, is there any scenarios where Xslt is the way to go when doing template stuff?
Xslt is deemed to be very fast. How fast is Razor compared to Xslt?
As far as I understand, it's not possible currently to traverse the content tree with Razor, so won't be too good at creating nested navigation lists etc. So for the time-being at least, I'll be building my site navigation with XSLT. No doubt this will change.
I also want to place a bet for the good use of uComponents.uQuery here as I understand it's a set of helper functions for (among other things?) finding & traversing both content and media nodes.
The currentPage object which is being passed into the razor template will have an AnccestorOrSelf method on it for the next Juno release (it's in the nightlies) so it'll have more functionality similar to what can be done for XPath
Thanks Slace. Do you know if Razor is as fast as XSLT? I presume the view engine will be comparable to xslt but is the processing more or less intensive?
I guess if its working from Memory as the XSLT stuff does then there will be no speed issue. However if the Model was calling the database for example then there would be a speed differnece and i guess this is what i'm talking about really. Is Razor working from the same data held in memory as the XSLT?
Razor with Umbraco 4.6 - Thumbs up! - Razor and Xslt
This morning I was reading Slace's blog entry about Razor in Umbraco 4.6 If you didn't you should:
http://www.aaron-powell.com/umbraco-4-and-razor
Razor is the new view engine that ships with MVC 3. Scott Guthrie talked a lot about Razor for MVC3. He mentionned that Razor would be available for webforms as well, but later...
>>>>>>>>> Its a sad day for us WebForms developers that such a thing wont exist there or so I think because you havent talked about that in the post atleast,so how can we use it in Web Forms?
You'll be able to use .cshtml/.vbhtml files within web forms based applications as well. Stay tuned.
Hope this helps,
Scott (http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx)
Well, the Umbraco team did a fantastic job for integrating Razor in our favorite webforms CMS. The team did it well before S. Guthrie blog about it ;o)
In short: Well done!
One question: I love Xslt. I am wondering if they are scenario where Xslt is more appropriate than using Razor. Xslt is not a programming language while you can take advantage of C# when using Razor (Well Xslt has Xslt extensions).
A part from the comfort of having several options, is there any scenarios where Xslt is the way to go when doing template stuff?
Xslt is deemed to be very fast. How fast is Razor compared to Xslt?
Thanks for reading.
Roland
As far as I understand, it's not possible currently to traverse the content tree with Razor, so won't be too good at creating nested navigation lists etc. So for the time-being at least, I'll be building my site navigation with XSLT. No doubt this will change.
Using common cs-code, linq2sql or old friend Nodefactory, it's indeed possible to do some traversing.
And the functions-syntax makes it possible to add functions aswell (for recursiveness):
I also want to place a bet for the good use of uComponents.uQuery here as I understand it's a set of helper functions for (among other things?) finding & traversing both content and media nodes.
Regards
Jonas
hm... problems with the tags when I try to edit. Here's a quick and dirty full nodestructure ul-li in razor:
Thanks for the help guys. I'll continue to investigate and do some prototyping as well.
Does anyone have any comments on the Speed question? XSLT can be cached too is it possible to cache razor templates?
Cheers
Jon
There's currently no caching on Razor templates.
The currentPage object which is being passed into the razor template will have an AnccestorOrSelf method on it for the next Juno release (it's in the nightlies) so it'll have more functionality similar to what can be done for XPath
Thanks Slace. Do you know if Razor is as fast as XSLT? I presume the view engine will be comparable to xslt but is the processing more or less intensive?
Cheers
I don't know why people are so interested in speed comparisons, you'll be looking at millisecond differences anyway.
I once compared IronPython to XSLT and it was negligible in terms of performance differences (although IronPython was faster).
I guess if its working from Memory as the XSLT stuff does then there will be no speed issue. However if the Model was calling the database for example then there would be a speed differnece and i guess this is what i'm talking about really. Is Razor working from the same data held in memory as the XSLT?
Like all other macros it uses the XML cache
is working on a reply...