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.
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.
Click on the folders to view the pages, links, and files contained in that folder.
I hope you learn something from our code and let me know if you have any problems or suggestions.
— Looking for Windows Azure training? Need help getting going with Windows Azure? Want some architectural guidance? Drop us a line at firstname.lastname@example.org and be sure to check out the course description for our upcoming Windows Azure Application Architecture & Development course!