Error with Azure local development storage and table named 'event'

While working on an Azure event-sourcing provider for my CQRS framework I came across a really strange problem so I’m posting the details in-case anyone else comes across a similar issue so they can save wasting as much time on it as I did! Basically, the local development storage doesn’t seem to like you having a table called ‘event’ (I haven’t tested it on the live system).

Here is some test code to demonstrate the behavior:

class Program
    static void Main(string[] args)
        const string tableName = "test";
        var storageAccount = CloudStorageAccount.DevelopmentStorageAccount;

        var tableClient = storageAccount.CreateCloudTableClient();

        var dataContext = tableClient.GetDataServiceContext();

        var bobdylan = new Artist
                PartitionKey = "folk",
                RowKey = "bob-dylan",
                Name = "Bob Dylan"

        dataContext.AddObject(tableName, bobdylan);

[DataServiceKey("PartitionKey", "RowKey")]
public class Artist
    public virtual String PartitionKey { get; set; }
    public virtual String RowKey { get; set; }
    public DateTime Timestamp { get; set; }
    public string Name { get; set; }

With the table called ‘test’ in the example shown everything works fine and the table and data appear in the storage explorer:

If we change the table name to “event” though we’ll get a DataServiceRequestException raised when we attempt to save changes:

Strangely, the table does get created OK but just won’t let you save anything into it. I originally thought this may be an issue with a SQL reserved word (because the development storage is simulated using a SQL database) but I’m not sure this is the actual cause.

I guess I can’t have an ‘event’ table like I wanted and will have to settle for ‘events’ instead!

blog comments powered by Disqus
30 June 2010