I needed a platform on which to implement them, and settled on Windows Azure as my backend .
I figured I'd share some of my experiences with the cloud as I go, after all, it's a new environment to many of us, and the more we can inform each other, the more we can make of it.
So, a handful of tips and stories, to recap the last week or so of my life:
Connecting to a SQL Azure database
Trying to connect to the database engine itself in Management Studio won't work.What you can do is connect directly to a database, by clicking "New Query", filling in the database connection string, which you can grab from Azure's management portal, and then specifying the database itself in the Additional Connection Parameters tab, like in the picture yon:
Moving out of SQL, and into Table Storage
I've decided to remove SQL from my backend, for various reasons. The first thing I needed to do was rejigger my entities to derive from TableServiceEntity class.
This was a fairly simple task, as I didn't have very deep object graphs to work with, but since table storage works as a list of key/value pairs, no relations between objects are stored, and you must restructure data so each thing can stand by itself.
A quick solution I came up with for storing complex object graphs was to derive a simple base class from TableServiceEntity, which exposes domain specific key, holds a property storagetext, and a reference to an object which implements an interface, IThingTranslator
All my entites now derive from Thing, and an appropriate concrete instance of ITranslateTableEntry
public interface IThingTranslatorwhere T : Thing {T Translate(string s);string Translate(T thing);}
This is a pretty flexible approach, as it lets me swap out my serialization routines to use the most appropriate one. I use JSON if I want to work with an object on the client, or something more optimized if I wanted it only in server side or lower level code, and changing between them is merely a configuration tweak.
My ongoing shenanigans can be followed at http://playground.cloudapp.net, and I'll of wild adventures about developing for WebKit and Android, using Microsoft IDEs and server-side tools. Stay tuned!

No comments:
Post a Comment