From Tools to Tunes, the MVC Music Store helps you learn MVC...

I've been wanting to highlight this post and since we've doing some music stuff this week... (and yet this is very different than the other). What if I were to tell you there's not only a pretty complete "music store" web site available, with source, but that it was built with ASP.Net MVC v3 AND there was a step by step tutorial on how to build such a site yourself?

MVC Music Store Updates - MVC 3 Tools Update Features, Scaffolding, Save Points, VB.NET Code

The latest drop of the Mvc Music Store tutorial cover the ASP.NET MVC 3 Tools Update, Scaffolding, Entity Framework Code First, SQL Server CE, and more. Additionally, this drop includes a VB.NET translation of the finished project as well as save points how the code should look when you complete each section.

...

Where to get the updated tutorial

As always, you can download the latest release of the Mvc Music Store tutorial - PDF document and code - from http://mvcmusicstore.codeplex.com. You can also read the content online starting at http://www.asp.net/mvc/tutorials/mvc-music-store-part-1

New Feature: VB.NET Code

This release includes a translation of the the completed project code to VB.NET (thanks, Lisa Feigenbaum and team!). We've had a lot of VB.NET developers follow the tutorial in the past, converting each step to VB.NET as they went. Hopefully having a working sample of the completed project in VB.NET will make that a lot easier. VB.NET dev's, I'd be happy for any feedback on this!

...

New Feature: Save Points

I always make several runs through the tutorial each time I update it to make sure the code is accurate, compiles at each step, etc. I've been capturing save points as I complete each chapter for my own sanity and efficiency, and for this release I'm publishing those as well. There's an optional zip download that includes a separate copy of the application as it looks at the completion of each major chapter. Since the first chapter is an overview of the install and file / new project experience, the snapshots start at Chapter 2:

...

Changes related to the MVC 3 Tools Update

I published another big update for the MVC Music Store tutorial during MIX11 to coincide with the ASP.NET MVC 3 Tools Update release. It was a pretty major rewrite, so I published it as a Beta. Since then I've corrected and clarified a few things in the tutorial document (no code changes) and upgraded to a stable release.

The biggest changes to the tutorial were:

  • Converting the Store Manager (Admin) section to use the new scaffolding system
  • Switching data access to use SQL Server CE and Entity Framework Code First
  • Explaining software prerequisites and installation
Changing the Store Manager to use Scaffolding

This section of the tutorial focuses on building out admin create/read/update/delete support for the albums carried in the music store. Previously, the tutorial had you create the controller, write the required code, and manually create each view. The new update leverages the scaffolding system to generate the majority of this code via scaffolding, then explains how the generated code works. ...

...

Switching data access to use SQL Server CE

A large percentage of the support issues for previous releases have been due to data access. Like many .NET developers, I have a love / hate / really hate relationship with SQL Server Express. It's one of those technologies that either works transparently, or doesn't work for some bizarre reason that's really painful to troubleshoot. It was heartbreaking to try to help developers through previous versions of the tutorial at Web Camp events who couldn't get SQL Server Express running on their laptop for some reason or another. It generally works pretty well for me, but there are times where it's given me problems, as well. SQL Server Compact provides a much simpler getting started experience, where you just want your data to be persisted without troubleshooting service permissions and installation issues.

The tutorial materials still include an MDF file and SQL Scripts in case you want to use SQL Server Express or a dedicated SQL Server instance, but I think the SQL Server Compact experience should work a lot better for most people.

Explaining software prerequisites and installation

This tutorial includes more information up-front about what you need installed and how to get it. Again, some of this is based on user questions and issues from the forums, in person, etc. The first chapter now includes information about how to install the required software - either via Web Platform Installer (recommended) or via individual installers if you prefer. ...

Here's a snap of the site;

image001

And I said tutorial, right? About about a 138 page PDF? Taking you through every step, even downloading the tools to build it all with.

image

Where is the magical project, source and tutorial?

http://mvcmusicstore.codeplex.com/

Project Description
MVC Music Store is a tutorial application built on ASP.NET MVC. It's a lightweight sample store which sells albums online, demonstrating ASP.NET MVC's productivity features and data access via Entity Framework 4. See what you can do with MVC in under 1000 lines of c# code!

Overview

  • Demonstrates ASP.NET MVC 3 Templating, Data Annotations, and Validation
  • Demonstrates Razor syntax and advanced features
  • Shows Client-Side Validation, jQuery, and use of AJAX helper methods
  • Includes store browse, shopping cart, checkout, and membership
  • Shows data access via Entity Framework 4
  • Illustrates use of ViewModels
  • This tutorial requires Visual Web Developer 2010 Express and ASP.NET 4.0 (both free) or Visual Studio 2010


Read the full tutorial online on the ASP.NET website.

Here's a peak at the VB.Net version of the Project;

image

Looks like allot, but the each file is actually pretty small, or is simple stuff (like the models) or Razor markup, like;

@modeltype List(Of MvcMusicStore.Album)
@Code
ViewData("Title") = "ASP.NET MVC Music Store"
End Code

<div id="promotion">
</
div>

<
h3><em>Fresh</em> off the grill</h3>

<
ul id="album-list">
@For Each album In Model

@<li><a href="@Url.Action("Details", "Store",
New With {Key .id = album.AlbumId})">

<
img alt="@album.Title" src="@album.AlbumArtUrl" />
<
span>@album.Title</span> </a>
</
li>
Next
album
</ul>

If your new to MVC then this project, and the awesome tutorial, is a great means for you to get up to speed...

Page image, Lucid Music, cutesy of j_baer

Follow the Discussion

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.