— New online course!  Getting Started with Azure DevOps — Special launch price 50% off —

Windows Azure Sample Code – A Real Application

by

We here at Benjamin Day Consulting, Inc have been working on creating a training course for Windows Azure.  Rather than just showing the students how to do basic skills and coding with Windows Azure and Azure Storage, I wanted to be able to make some architectural recommendations and be able to describe the best practices for not just coding but also unit testing.  (Just because Windows Azure is a new technology doesn’t mean that developers should ignore known and established best practices, right?)  So, this pretty much meant that we had to write a real application.

What we wrote was a content management system to run and maintain a web site.  Download the source code.

I’ll be writing more about this code (hopefully) over the next few months. 

Here are some of the goals for the application:

  • unit testing & testability
  • use Windows Azure Storage as the back-end
  • use the Repository pattern to encapsulate the data access logic for maintenance and testability purposes
  • use the Domain Model and Service Layer patterns for business logic
  • use Domain Model objects that require complex saves across table storage and blob storage
  • implement lazy loading for properties on the domain model objects in a medium-trust environment
  • use Model-View-Presenter in the ASP.NET presentation tier
  • re-usable storage logic using C# generics
  • Forms Authentication security using the sample Membership and Role providers
  • Dependency Injection using Unity with Windows Azure
  • Access Windows Azure Storage from outside of a hosted Windows Azure application role

There are two projects that you need to know about in the sample code: Benday.Cms.CloudService and Benday.Cms.Security.WpfUi.  The CloudService project governs all the role-based code.  The WpfUi has all the initialization logic for storage and allows you to set up an administrator user and create test content for the web site.

image

When you start the CloudService project, it will start up the Azure WebRole for the web site.  This is the Benday.Cms.WebUI project.  Once you have used the WpfUi application to add an administrator, you can log in to the administrator web site by going to http://localhost:81/administrator.  The default username is administrator and the default password is P@$$w0rd.  If you’ve used WpfUi to create test content, you’ll be dropped in to the Folder List screen and you should see 3 content folders for the website.

image

Click on the folders to view the pages, links, and files contained in that folder.

image

I hope you learn something from our code and let me know if you have any problems or suggestions.

Download the source code.

-Ben

Looking for Windows Azure training?  Need help getting going with Windows Azure?  Want some architectural guidance?  Drop us a line at info@benday.com and be sure to check out the course description for our upcoming Windows Azure Application Architecture & Development course!

 


One Response to "Windows Azure Sample Code – A Real Application"
  1. As a developer, you should accumulate a core set of patterns that will help you develop cloud applications most effectively. In addition, you should remember to capture and share recurring solutions to problems and other emerging patterns such that our solutions and products can provide better out-of-the-box support for core cloud computing patterns.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: