Tag Info

New answers tagged

0

I can think of a perfect Don't do it example. Lets say we have a ProductController: public class ProductController() { public ViewResult Discontinued() { var db = new ProductsDb(); var products = db.Products.Where(x => x.Discontinued).ToList(); return new ViewResult(products); } } With razor we have an alternative ...


8

You are confusing "separation of technologies" with "separation of concerns". The basic idea behind the "View" portion of MVC is that code in the "View" is not performing any data access or heavy logic directly, rather that is left to the "Model" and "Controller" portions respectively. The "Controller" transforms the data, performs any necessary logic, and ...


33

Rather than directly answer the question, my response questions the assumption made in the question. That is, the assumption that Razor was built for MVC is incorrect. I work at Microsoft on the ASP.NET team and have first-hand knowledge of this. Razor did not start out as a view engine for MVC. It was created for ASP.NET Web Pages, which is probably as far ...


59

You are conflating the Razor syntax with separation of concerns. Separation of concerns has to do with how you structure your code. Being able to use C# in views doesn't prevent that. It has nothing to do with separation of concerns as such. Sure, you can structure the code in your view to not comply with separation of concerns, but what about C# code ...



Top 50 recent answers are included