Building Forms with MVC2 and EF4

I’ve always thought that working with forms in ASP.NET was a bit messy, but with the recent launch of Entity Framework 4 and MVC 2 (both part of Visual Studio 2010 / .NET 4), there is some really nice functionality to take advantage of. I got off to a great start by reading through Scott Guthrie’s NerdDinner sample to get a feel for MVC concepts. However, his sample is based on MVC 1 and used LINQ-to-SQL rather than EF, so I found that quite a bit of the information wasn’t applicable.This post shares some points on building MVC 2 forms more effectively using the Entity Framework. A few things that I wanted to get right in particular were business rule validations for form elements, use of foreign key associations within the form, and strong typing so that errors are caught at compile time rather than at run time.

This post demonstrates the creation of a form for creating and editing an individual Product. The Product object has a VendorId property that relates to a Vendor object.

Continue reading “Building Forms with MVC2 and EF4”

“Tabify” – the No Markup jQuery Plugin

I needed to introduce a tabbed layout for displaying details of certain products within a web-based e-commerce product we use.

The product includes a WYSIWYG editor, which enables product details to be entered without any (or at least limited) HTML knowledge. The problem is that quite a bit of additional markup was needed to implement the tabbed layout, and that meant that our business users would have difficulty maintaining the content accurately.

To solve the problem I created a jQuery plugin for converting content into a tabbed layout without needing to manually inject additional markup for formatting. Here’s how it works:

Continue reading ““Tabify” – the No Markup jQuery Plugin”

Version Control Software: From VSS to Mercurial

Until a couple of years ago, I used VSS for source code version control. VSS is not a very capable or reliable product, but the licensing cost for Team Foundation Server prevented me from switching to Microsoft’s newer technology.

Then I switched to Subversion, using VisualSVN for Visual Studio integration. At only $49 for each client, and the standard edition server component at no cost, this has proved to be a really good improvement over VSS. We have been very happy with Subversion.

In the past year or so, there has been a lot of hubbub about Distributed Version Control Systems. Armed with a basic understanding of the unique “distributed” nature of these systems, I could see the value for large team environments, but I had a hard time appreciating the increased value offered to the smaller corporate or community team.

I learned enough to know that there were two main players out there – Git and Mercurial. They both have developed great reputations, but for development scenarios that I’m likely to be involved in, Mercurial seems like the better choice. The main reason is that it’s simpler to use. Version control can be complex to manage, and only works as well as the lowest common denominator in your team’s understanding of the version control product workflow and behavior.

So, if you’re trying to decide what Source Control System to use, consider giving Mercurial a try. Here are the main resources you’ll want to check out:

Let me know your experience if you decide to try out Mercurial.