AngularAzureSearch.WebAPI.PartitionResolvers.ManagedHashPartitionResolver.GetCollections C# (CSharp) Method

GetCollections() private static method

Gets or creates the collections for the hash resolver.
private static GetCollections ( Microsoft.Azure.Documents.Client.DocumentClient client, Microsoft.Azure.Documents.Database database, int numberOfCollections, string collectionIdPrefix, DocumentCollectionSpec spec ) : List
client Microsoft.Azure.Documents.Client.DocumentClient The DocumentDB client instance.
database Microsoft.Azure.Documents.Database The database to use.
numberOfCollections int The number of collections.
collectionIdPrefix string The prefix to use while creating collections.
spec AngularAzureSearch.WebAPI.Helpers.DocumentCollectionSpec The specification/template to use to create collections.
return List
        private static List<string> GetCollections(
            DocumentClient client,
            Database database,
            int numberOfCollections,
            string collectionIdPrefix,
            DocumentCollectionSpec spec)
        {
            var collections = new List<string>();
            for (int i = 0; i < numberOfCollections; i++)
            {
                string collectionId = string.Format("{0}{1}", collectionIdPrefix, i);
                var collection = DocumentClientHelper.GetCollectionAsync(client, database, collectionId, spec).Result;
                collections.Add(collection.SelfLink);
            }

            return collections;
        }