tsJensen

A quest for software excellence...

Windows Azure Tools SDK (November 2009) Refactor or Restart?

The 1.0 release of Windows Azure SDK is now available. Download and read about what’s new here. Sadly, the AspProviders sample project was not included. I spent a few hours trying to bandage it up, but it was a hopeless cause. If a new AspProviders sample is not soon forthcoming, it will be easier to write one from scratch using the new SDK and the new project templates.

Update (11/22/09) - AspProviders in Additional C# Examples: One comment and an additional private email from readers have pointed out Azure Code Samples on MSDN where you can download the "Additional C# Samples" which contatin the new AspProviders. I'll be checking out this and other samples with the new Azure SDK. Thanks to both Jason and Gerold for the links.

When I tried to run my old project, after modifying some references to match those of a fresh project created with the new Visual Studio templates, the first thing that popped was a new local storage database script dialog result:

az-nov09-01 

I’ve not explored them in detail but there are several new tables, some stored procedures and a few user defined functions in the new dev storage database.

I clicked okay and before I got my next error, I noticed the new baloon dialog name for the dev fabric, Windows Azure Simulation Environment:

az-nov09-02

I also compared the csCFG and and csDEF config files for the Azure cloud service project. The XML namespace is the same and as near as I can tell there are no changes there.

The next thing I noticed was a new class in the web role of the new project template. Seems we now have a “Windows Service”-like OnStart and RoleEnironmentChanging set of startup and status change event handlers. This will be highly useful for web role applications that may have resource cleanup needs.

public class WebRole : RoleEntryPoint
{
	public override bool OnStart()
	{
		DiagnosticMonitor.Start("DiagnosticsConnectionString");

		// For information on handling configuration changes
		// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
		RoleEnvironment.Changing += RoleEnvironmentChanging;

		return base.OnStart();
	}

	private void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
	{
		// If a configuration setting is changing
		if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange))
		{
			// Set e.Cancel to true to restart this role instance
			e.Cancel = true;
		}
	}
}

Another bit of great news is that the StorageClient goes from “sample” project to part of the release libraries. There were ample changes there which appear to have broken the AspProviders sample project severely. While that explains the missing AspProviders project disappointment, I do hope that it means the changes in the StorageClient namespace will make using Azure storage easier.

Much more to learn and blog about with the new release, but it looks as though I’ll need to start over on my “Aventure” sample. I’m glad that I don’t have loads of code to refactor to the new release. It makes starting over less painful. For those who have written large projects relying on the beta, all I can say is, “beta = subject to change.”