async Task <DocumentCollection> CreateCollectionAsync(string databaseLink, string collectionName, CollectionOfferType offerType) { var collection = new DocumentCollection() { Id = collectionName }; var requestOptions = new RequestOptions() { OfferType = ComvertOfferTypeToString(offerType) }; return(await _client.CreateDocumentCollectionAsync(databaseLink, collection, requestOptions)); }
static string ComvertOfferTypeToString(CollectionOfferType offerType) => Enum.GetName(typeof(CollectionOfferType), offerType).ToUpperInvariant();
public DocumentCollection GetCollectionIfNotExistsCreate(string collectionName, CollectionOfferType offerType = CollectionOfferType.S1) { var collection = TryGetCollection(DatabaseInstance, collectionName) ?? CreateCollectionAsync(DatabaseInstance.CollectionsLink, collectionName, offerType).Result; if (collection == null) { throw new InvalidOperationException($"コレクションの生成に異常ありんご!({collectionName})"); } return(collection); }