Пример #1
0
 public async Task CreateAsync(ArangoHandle database, string collection, ArangoCollectionType type,
                               CancellationToken cancellationToken = default)
 {
     await SendAsync <ArangoVoid>(HttpMethod.Post,
                                  ApiPath(database, "collection"),
                                  new ArangoCollection
     {
         Name = collection,
         Type = type
     }, cancellationToken : cancellationToken);
 }
Пример #2
0
        public static void CreateTestCollection(string collectionName, ArangoCollectionType collectionType = ArangoCollectionType.Document)
        {
            var db = GetTestDatabase();

            if (db.Collection.Get(collectionName) != null)
            {
                // delet collection if it exists
                db.Collection.Delete(collectionName);
            }

            // create new test collection
            var collection = new ArangoCollection();

            collection.Name = collectionName;
            collection.Type = collectionType;

            db.Collection.Create(collection);
        }
Пример #3
0
        public static void CreateTestCollection(string collectionName, ArangoCollectionType collectionType = ArangoCollectionType.Document)
        {
            var db = GetTestDatabase();

            if (db.Collection.Get(collectionName) != null)
            {
                // delet collection if it exists
                db.Collection.Delete(collectionName);
            }

            // create new test collection
            var collection = new ArangoCollection();
            collection.Name = collectionName;
            collection.Type = collectionType;

            db.Collection.Create(collection);
        }
Пример #4
0
 public async Task CreateCollectionAsync(ArangoHandle database, string collection, ArangoCollectionType type,
                                         CancellationToken cancellationToken = default)
 {
     await SendAsync <JObject>(HttpMethod.Post,
                               $"{Server}/_db/{DbName(database)}/_api/collection",
                               JsonConvert.SerializeObject(new ArangoCollection
     {
         Name = collection,
         Type = type
     }, JsonSerializerSettings), cancellationToken : cancellationToken);
 }