Windows Azure Developer Challenge – Day Three (May 1st)

I’ve decided to build the next Facebook! Just kidding, but dreams are free right? Happy May day!

After looking at various free CSS templates on yesterday I got a bit stuck as I wasn’t sure whether I should go for the one that looked really good, but which had some very complicated looking CSS that I couldn’t get my head around in a short time, OR whether I should start with something simple like a grid layout and build up from there. My dilemna is that I’m not very good at producing graphics, and they take me a long time to make, so by getting a pre-built template I can avoid all the hassle. In saying that, I like to know what’s going on in the CSS in case I need to modify it. Maybe I’ll have to use a bit of both? Moving on….

Membership (Not for now)

I’d like users to register in order to create conferences, however, since we’re not going to be building any sort of membership mechanism for this part, I’m going to allow anyone to create conferences without registration. I did find a membership provider for table storage in the Azure code samples, however, it didn’t include the Facebook/Twitter authentication which I know comes bundled with SimpleMembership. I think I’ll wait till I get SQL before I go further with membership.


I need to be able to record conference details (sessions, speakers etc) and will try and get something working for that today. In Scott’s article he mentioned using an xml file stored in DropBox for the data, which seemed like a pretty good idea for a single conference. However, given that we’re building a site to (hopefully) host lots of online conferences, and because this is a good chance for me to learn about Azure, I’m going to look into using one of the Azure Storage options (Queue, Table, SQL). Since I’m trying to avoid using SQL till the third part of this challenge, I think I’ll go with table storage as it’s fast, easy to setup, and gives me a chance to learn a new tool.

I started reading up on Partition/Row keys, and found this article very helpful –

Azure Table Storage, so many options….

I got setup and created a table as per, however, I soon realized that I didn’t quite understand table storage quite as well as I’d thought! Basically I planned to store each conference, including speakers and presentations, as a single table entity, so that I could store/retrieve each conference in one go. I started out writing code for the Conference class as below:

public class conference
    public conference()
        presentations = new list<presentation>();
        speakers = new list<speaker>();

    public string hashtag { get; set; }
    public string name { get; set; }
    public string description { get; set; }
    public ilist<presentation> presentations { get; set; }
    public ilist<speaker> speakers { get; set; }
    public string abstract { get; set; }
    public datetime startdate { get; set; }
    public datetime endtime { get; set; }
    public string timezone { get; set; }

When I tried to save one of these I ran into a bit of a roadblock though…Unfortunately you can only store primitive properties for a table entity, but not child collections or complex child objects. DOH! So, how could I work around this? I found a number of options:

  • Store each object type as a separate entity, E.g. Conference, Speaker, Presentation all get their own rows in the table. I wasn’t too keen on this as it seemed like more work than it was worth. Plus it seemed far more efficient to retrieve the whole conference in one hit rather than having to retrieve each entity separately then combine them in the UI.
  • FatEntities – – this looked very thorough, although I don’t think it wasn’t up to date with the latest Azure Table storage api
  • Lucifure – – this also looked like it wasn’t up to date with the latest Azure Table storage api
  • Serialize the Conference as a JSON string. In the end I chose this option as it was easy to implement and allowed me to store the whole conference in a single table row. I used JSON.Net as it’s already included in the default MVC4 project, and allows me to serialize/deserialize in one line.

Some sample code from my YouConfDataContext.cs class for doing Inserts/Updates is below:

public void UpsertConference(Conference conference)
    //Wrap the conference in our custom AzureTableEntity
    var table = GetTable("Conferences");
    var entity = new AzureTableEntity()
        PartitionKey = "Conferences",
        RowKey = conference.HashTag,
        Entity = JsonConvert.SerializeObject(conference)
    TableOperation upsertOperation = TableOperation.InsertOrReplace(entity);
    // Insert or update the conference

where AzureTableEntity is just a wrapper class for a Table Entity:

public class AzureTableEntity : TableEntity
    public string Entity { get; set; }

Progress at end of day: I’ve managed to insert some conferences, but am still a bit stuck getting the UI looking nice as I’m flip-flopping between using a custom CSS template or just building from scratch with the grid layout like


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s