Using MVC with ASP.NET

Some of you may have noticed that I didn't make any updates to listforge over the weekend. Alas, I was busy with bigger things. As part of a recent opportunity, I've begun honing my skills with ASP.NET and am in the process or rewriting my Caturday page using its new MVC framework (Really, it took them this long to get one out there). All of us cool kids who use Ruby on Rails have been using MVC so long that we've tired of it and are moving on to REST, but MS as usual is lumbering along behind us. I must say that I'm thankful, though. The concept of MVC is a much needed design pattern for web applications and an incredible difference over Code Behind.

The process itself is actually going quite well and I'm learning a lot on the way. For instance, if you pass variables in to the controller statement it seems to eat the Request.Files children. You have to actually use the MvcToolkit (totally different from the MVC extension) and use .UpdateForm (not .UpdateFrom like the MSDN blogs say) to populate entry data.

One other item of note is that unit testing out of the box doesn't work if you're using a local database file. There doesn't appear to be a way to set "development", "testing" or "production" databases within the projects and unfortunately the testing project that gets created fails to recognize the database specified by the main application. I pulled my hair for quite some time, thinking that I destroyed some crucial application bit, before realizing that the testing just plain didn't work. After firing up the web server, I realized that everything was just fine.

I'm using ASP.NET 3.5 so I also get the beauty that is LINQ. Really, it is .NET's redeeming feature. The ability to query any (of the widely supported) enumerable type(s) using a SQL-like language is phenomenal. It even brings with it ORM style object addition and data-store commission allowing things like "LinqContext.Items.Add()" for anything ranging from XML files to SQL Databases to you're usual arrays. Delicious.

Interested in trying some MVC development in ASP.NET? You can download the extension itself from Microsoft's Official ASP Site and the Toolkit Extras or MvcToolkit from Microsoft's Official ASP Site. If you're looking for help, Scott Gu's blog has an excellent series of articles on the matter (though in typical MS fashion, no decent way to find them). Obviously you'll need a copy of Visual Studio Web Developer (or VS2008 Pro in my case) in order to get going with this.



Required
For gravatar support
Required