-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No happy-path for creating a table if it doesn't exist. #41
Comments
Hi Tom, Nice idea to add such feature. So it would be great if you extend ITableSet interface and add a new method a la |
Just submitted a very simple pull request which just exposes the |
Unfortunately such implementation exposes types from Azure .NET SDK library, but ITableSet should use only abstract data types. So it's better to just add pair of methods CreateIfNotExists / CreateIfNotExistsAsync in the interface like that: private readonly CloudTable _cloudTable;
public TableSet(CloudTableClient cloudTableClient, string tableName)
{
...
_cloudTable = cloudTableClient.GetTableReference(tableName);
...
}
public bool CreateIfNotExists()
{
_cloudTable.CreateIfNotExists();
}
public Task<bool> CreateIfNotExistsAsync()
{
_cloudTable.CreateIfNotExistsAsync();
} |
I was considering taking that approach, but it seems like it opens Pandora's box of other |
Thanks, it was published: |
Thanks! |
It would be nice to have exposed methods to create storage tables when they don't already exist, or at least get a
TableReference
to the table being managed by theTableSet<T>
so that the standard methods can be used.It seems like it should be easy enough to store the
CloudTable
reference generated in theTableSet
constructor as a class member rather than having it be a local variable and expose that- if that approach works for you I can submit a pull request.The text was updated successfully, but these errors were encountered: