Friday, March 9, 2012

how to pull stuff out of a route on method binding in a web forms ASP.NET project (no kidding)

If one begins a method (in this example a Repository method) like so in a web forms implementation, one may pull values out of a route in a way akin to an MVC trick:

public Category GetCategory([QueryString]int? id) {

 
 

This trick was revealed in Scott Hanselman's keynote address at the Dallas Day of .NET convention this morning (3/9/2012) in the Las Colinas neighborhood of Irving, Texas. He brought this up as one of many examples of how he is striving to break down the strict division lines between different types of ASP.NET projects which he feels unfortunately create a false (or not so false) impression that the upfront decision on a type of a project is irreversible. Hanselman wants One ASP.NET and is to release a project of a comparable name around the time of the release for Visual Studio 11 that will have some tricks to this end. One of the things coming in One ASP.NET is an empty project type that just has a Web.config file.

Thanks to Ria Consulting and, specifically, Chander Dhall of Ria Consulting (pictured below) for setting up this event.

No comments:

Post a Comment