Thursday 25 November 2010

Windows Azure Table Storage stupid mistakes

Don't program when you're tired ...

I've been working through the Azure labs and as usual I don't stick exactly to the script (how're you supposed to learn anything if you don't challenge the boundaries? ;) ) So after 2 late hours I couldn't figure out why:
"storageAccount.CreateCloudTableClient().CreateTableIfNotExist("ThingOnes")
"
Created tables, but the more common
"CloudTableClient.CreateTablesFromModel(typeof(ThingContext),
                                                    storageAccount.TableEndpoint.AbsoluteUri,
                                                    storageAccount.Credentials);"

didn't.

I just noticed now that in my "ThingContext" here:
"
        public IQueryable<ThingOneThingOneEntities
        {
            get
            {
                return this.CreateQuery<ThingOne>("ThingOnes");
            }
        }
"
the property name of the entity set was different to the EntitySetName I declared.

Setting them the same made everything happy again.

In other words ... magic strings are evil!

No comments: