ASP.NET MVC3 And Other Microsoft Web Development Goodies

Last week, Microsoft unleashed a whole slew of new web development products for us to get to get excited about here at Affirma.  In fact, I think I’ll still Vishal Joshi’s sentiment of feeling like we are in a “Web Development Candy Store”!  The timing couldn’t have been more perfect as well, as we are just kicking up a new web development project that I have determined to use ASP.NET MVC3 along with some of these other new tools.  So I thought I’d take a moment to post some of my favorite bits that I have experienced so far.

Razor View Engine

Maybe it’s me, but when I was previously working on ASP.NET MVC projects, I always felt like I had some code-smell funk emanating from me when I’d look at those view pages filled with server code syntax that I’ve been seeing from WebForms and even ASP development.  MVC development is quick and lean to me and I always wanted a syntax that matched.  Enter Razor!

Old Way  Sad smile

<div class="contacts">
<% foreach (var c in contacts) { %>
<b><%= c.Name %></b> - (<%= c.PhoneNumber %>)<br>
<% } %>

New Way Smile

<div class="contacts">
@foreach (var c in contacts) {
<b>@c.Name</b> - (@c.PhoneNumber)<br>

And it has all the in-line, multi-line, nesting, and HTML helper support that I would expect.  Just keeps things clean and development fluid.

Razor Layouts/Sections

Like master pages, only better!  Okay, so that may be debatable, but being able to define the body or sections for widgets and other partials in a clean and simple manner just makes more sense to me.

@if (IsSectionDefined("widget"))
    <div class="widget">

@section widget {
<h3>Featured Articles</h3>
@Html.Action("Featured", "Articles")

SQL Compact 4

Okay, so we probably aren’t going to be deploying any of our website projects using SQL CE 4.  However, being an environment we many of us are on the go and working from different locations, it servers as a nice, lightweight database that our developers can use to whip up some code and features without having to make sure there is a SQL Server box to connect and query against.  Also, I think there are some cool rapid prototyping opportunities here to help us engage prospective clients.

Just started using this, but I’m already a fan.  What is NuGet?  Simply put, it’s a quick and easy to way to integrate all those tools and packages you use to develop right into Visual Studio.  Starting up my new MVC3 project, I knew I wanted NUnit, RhinoMocks, Fluent Route testing, as well as some other tools that I knew were scattered around on my hard drive but wasn’t sure if they were up to date.  No worries!  Just open up the console and type “Install-Package MvcContrib.Mvc3.TestHelper-ci” and boom!  My test project is almost set up!  I foresee a lot of value with this tool moving forward, so I’m looking forward into how it develops.


Speaking of NuGet, this is probably the coolest library I’ve downloaded so far from NuGet.  It integrates right into the console and allows me to quickly code-gen, or “scaffold”, some of the basic MVC structures I’ll need for my project.  I created my business object, and then via one line I was able to generate an Entity Framework Code-First context, Repository, Controller, and all the views for CRUD operations.  Now, I didn’t need all the CRUD operations, but so what!  It’s easy to go in and delete or tweak what I didn’t need.  The tool is great for stubbing out the very basic bones of your project that you can then go in and build on top of.  Plus, it supports T4 templates so who knows what other cool scaffolds will be created by the open source community!

I’ll continue to post other nuggets of goodness I come across while working on this project, but for now there is definitely an abundance of web development candy for me to geek out over the next few weeks.  Just ask some of the folks around the office, I’ve been a jabbering fool on a sugar-high all week!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: