Pretty Dump LINQPad Extension method for DynamicTableEntity
Often, I write my Azure Storage Table queries on LINQPad and copy over to Visual Studio. I find this workflow faster as I can quickly execute the queries and see the results using the Dump()
extension method. (Many people have tried to port it to Visual Studio and if you are looking for something similar look here and here)
I generally use DynamicTableEntity on LINQPad
as it saves some time. But since DynamicTableEntity
contains all the properties as IDictionary<string,EntityProperty>
calling Dump()
on it won’t print an easy to read output.
But wait, I discussed about ToDynamicList method I wrote for Azure Table Browser on this post. So passing the DynamicTableEntity
collection through this method before dumping will convert it to a flat list. Quick and easy..!
But calling ToDynamicList()
every time before calling Dump()
is tedious. can we just override the original Dump()
method? Well, I did not find a strait-forward way to do it; though, I kind of got it working.
One limitation here, is I need to do a ToList()
before calling Dump()
since the type is not IEnumerable<DynamicTableEntity>
at run-time, easy hack was to do a ToList()
.
Paste this custom Dump()
extension method on LINQPad
’s My Extensions
file along with ToDynamicList
extension method, and resolve the dependencies. You are all set to use it. Here is a simple driver program to show how to use it:
I have created a gist with complete code here. And if you find a better way to override Dump()
, do let me know in the comments… :)