0

I have been following along Adrian Hall's 30 Days of Zumo(link).

I have a question regarding Azure Storage controller and storage container names. Is it possible to default all file uploads to a single container? I have read about IContainerNameReslover but haven't got very far with that. Currently the files upload but create a different containers based on the current record I am editing within my Xamarin Forms application.

David Makogon
  • 69,407
  • 21
  • 141
  • 189
D. Hewey
  • 1
  • 1

2 Answers2

1

A Microsoft Azure Storage account contains containers by definition - this is where files are stored. Azure won't limit you: Whether you want to create one container per file upload, or one container with every file upload.

The sample github code for the resource you linked can be found at their github repo. What you see there is a connectionstring that defines both the connection to the storage service in Azure, as well as the container name the files are uploaded too. I'm not too familiar with the tutorial in question, I'd suggest you look in the Azure documentation regarding the features of the API that you can use.

Erik J.
  • 799
  • 6
  • 19
  • Hi Erik - Thanks for the quick response. – D. Hewey Mar 23 '17 at 12:08
  • Hi Erik - Thanks for the quick response. Originally, I used the code in the GitHub link you posted and successfully changed the container name. I was able to re-direct and re-name the files uploaded. Once I added file sync capabilities(from Adrian's link above), it does not use that class. I created a new controller ( public class ExpenseLineStorageController : StorageController) which uses IContainerNameResolver to default the container name to "TableName-ID" – D. Hewey Mar 23 '17 at 12:30
  • 1
    Here is the link to how I am approaching it now. https://learn.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-xamarin-forms-blob-storage – D. Hewey Mar 23 '17 at 12:33
0

As discussed in this question a long time ago: if you're direct-accessing a blob, it's irrelevant how many blobs are in a container. You can have millions of containers, with one object per container. And you could have a million objects in a single container. If you are accessing a blob directly by uri, then the decision is going to be about security boundaries and general organization. Performance will be the same in both cases.

However: if you have to enumerate blobs in a container, then the enumeration operation takes longer as the number of items in the container grows. So, if you have a million objects, all in a single container, expect that enumeration operation to take a while (as it will be multiple calls + continuation tokens to get a complete list).

Community
  • 1
  • 1
David Makogon
  • 69,407
  • 21
  • 141
  • 189