fsprojects / AzureStorageTypeProvider

An F# Azure Type Provider which can be used to explore Blob, Table and Queue Azure Storage assets and easily apply CRUD operations on them.
http://fsprojects.github.io/AzureStorageTypeProvider/
The Unlicense
84 stars 34 forks source link

Eagerly evaluate connection string. Issue #64 #69

Closed stewart-r closed 8 years ago

stewart-r commented 8 years ago

Proposed resultion for Issue #64

Added a 'checkConnectionString' function to Configuration.fs to check the validity of a connection string - I couldn't find a 'nice' way to do this in the Azure SDK so I just checked if an arbitrary table exists knowing that the SDK would throw an exception if the connection string was invalid.

I have also cached the validation result for each connection string in a Dictionary to prevent repeated calls - it is likely that if a a connection string is valid then it will remain so and, similarly if it is not valid it will remain so, no? I'd hope to prevent uneccesary traffic repeatedly verify the connection string. The validateConnectionString function wraps checkConnectionString using this cache.

I call into validateConnectionString from the buildTypes function in AzureTypeProvider.fs immeadiately after the connection string is built. We 'failwith' an error message wrapping the original exception if the connection string cannot be validated or continue with the existing code on Success.

This causes a 'red squiggly' in Visual Studio with a meaningful error message immeadiately after entering an invalid connection string

isaacabraham commented 8 years ago

Thanks for this! Looks like you managed to get up and running with it in the end :-) Let me give it a quick check and then merge in - looks good.

stewart-r commented 8 years ago

Yeah, got there in the end :-). Had a moment of joy yesterday when, after MUCH fiddling, I first managed to hit a break point!

Thanks for your guidance - it's much appreciated

isaacabraham commented 8 years ago

If you hit a breakpoint then that's more than I've ever managed to do :-)