So, like most of us, I thought hooking up table storage would be easy. Turns out, it’s not if like to keep up with the latest and greatest support libraries.
The first hiccup came when I tried to connect to my local storage service (UseDevelopmentStorage=true). Well, now you need to specify the URI that points to the local storage emulator and like the blog post author states, “it just magically works”
Now that I had the table sitting there, the next hiccup came when I asked my table service context to build the table if it doesn’t exist. This one was kind of bad, not something I expected. First I used the Azure SDK library my exception told me I needed, in this case Microsoft.Data.OData (v184.108.40.206). There’s a newer version of it as well, v.220.127.116.11, that didn’t work either even with an assembly binding redirect. I installed v5.4 with NuGet and then had to uninstall it manually by clearing out the package.config entries and dropping the references. Then using the Package Manager Console I installed v.18.104.22.168 instead w/o the binding redirect and it worked.
The last hiccup was getting the entities to insert into the table. You can find more about CRUD here, and Table Storage CRUD operations here. A side note on that embedded link, it discusses versions 1.7 and 2.0 – yesterday I was looking at 1.7, not 2.0 so check which form of the page you are looking at before you start coding.
My partition key was missing and the row key and the timestamp properties were null. I read that the table client took care of this for me, so I used DateTime.UtcNow for a default property, and fixed up my extension method that gen’d my TableEntity for me. That error came in the form of [ The remote server returned an error: (400) Bad Request ].
Here are the links I eventually found that bailed me out today. All the code is working and I added a few more guard statements to do some additional state checks before the CRUD bits fire. Hopefully, the blob storage stuff is ironed out implicitely as well with all of this dependency churn today.
HTH / oFc