Posts

Showing posts with the label Razor

Razor syntax in Javascript files

I don't always mix server side code with client side code... but continuing with my thoughts on server and client models. I wanted to know if I could use razor syntax in a javascript file. Which means I woud be able take advantage of the Asp.net Bundling and Minification feature. Now I probably didn't bring this approach up in the article but what I did talk about was using query url with the javascript. Not being able to cache javascript files is the major reason why avoid using using it and I didn't think I would take this approach either but I did want to see if it was possible.
  In my research I did notice some loss of performance, I didn't do any benchmarking but I felt the process was a little wonky. I think the third link best describes my thoughts on this approach. So what  I have been doing now since this is using the "data" attribute and assigning a value with razor syntax. It's not completely perfect but it does have some advantages. A lot …

Updating Razor 2.0 to 3.0 with Asp.net MVC

Currently updating an application from Asp.net MVC 4.0 to MVC 5.0 but before I update MVC I wanted to update the Razor package. Since the MVC package is dependent on the Razor. So this article is about Razor 2 to Razor 3 and the problems I faced.

Razor in my opinion
Razor 3.0 (details in the link) is an awesome package in my opinion and I shudder to think anyone who writes Asp.net MVC applications using ASPX. For me the Razor syntax is an effective way to write visually clean code and because of this provide very low maintenance.

Issues with Razor Updating from 2.0 to 3.0
As I updated I encounter numerous problem with the Razor package from 2.0 to 3.o and not only did it break my application but destroyed the Intellisense for Razor (mostly for ViewBags).
So for my first problem...
Inheritance security rules violated by type: 'System.Web.WebPages.Razor.WebPageRazorHost'. Derived types must either match the security accessibility of the base type or be less accessible.
Which c…