Friday, March 21, 2014

From Sandcastle HTML to Markdown

Reference documentation is important. Whether it's a programming language, a framework, a library or a web API, you simply cannot remember or understand every detail before you start writing code. And you shouldn't, because your brain should be free working on the problem you are trying to solve instead of memorizing APIs.

Thursday, February 20, 2014

Why ASP.NET MVC Routing sucks

2434 questions with the tag, plus 755 with and routing, that's more than 3000 questions about routing only. Clearly, something is wrong.

Tuesday, February 18, 2014

Using Razor and XSLT in the same project

I recently wrote about Razor vs. XSLT, you can find good reasons to choose either one. The good thing is that you don't have to settle for one, you can use both at the same time, and that's what this post is about.

Monday, November 18, 2013

Using action-based and verb-based routing in the same ApiController

Action method selection in Web API is a lot smarter than MVC's. The biggest difference is that the action route parameter is not required, allowing you to select an action based on the HTTP method of the request (verb-based). However, you can run into issues if you try to use both action-based and verb-based routing in the same ApiController.

Sunday, July 7, 2013

Razor vs. XSLT

Razor and XSLT are both excellent tools. The following table compares their strengths and weaknesses, you decide which capabilities are most important for your particular scenario. Feedback is welcome, and I intend to update this table as both languages evolve.

Saturday, May 18, 2013

ASP.NET Routing: Regex Constraints are inneficient

There are cases where using Regex constraints makes sense and does the job. For example, for action and controller parameters. If you have a constraint like action = "Index|About|Contact", that will prevent the handling, and URL generation, of non-existing actions. The framework only needs a string, from a list of valid values.

Thursday, April 18, 2013

Delegate-based strongly-typed URL generation in ASP.NET MVC

The standard way of generating URLs in ASP.NET MVC involves hard-coding action, controller and parameter names:
string url = Url.Action("Edit", new { id = 5 });
You are probably familiar with the expression tree-based strongly-typed URL generation approach, which is part of the MvcFutures library. It allows you to write code like this:
string url = Url.Action(() => Edit(5));

Friday, March 29, 2013

Attribute-based routing coming to ASP.NET MVC and Web API v5

Update: This post is based on early bits that later changed when v5 RTM was released. I suggest you read my post Why ASP.NET MVC Routing sucks instead.

Attribute-based routing is coming to ASP.NET MVC and Web API, according to the roadmap. They are basing the solution on the popular AttributeRouting project. At the date of writing this post only Web API support is working, you can play with it by installing the nightly packages.