Exemplo n.º 1
0
 private void CreateCollection(IArangoDatabase db, string collectionName,
                               CollectionType type = CollectionType.Document)
 {
     try
     {
         db.CreateCollection(collectionName, type: type);
     }
     catch (Exception)
     {
         // ignore, it already exists
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// detect if a type is vertex or edge and create the collection
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="arangoDatabase"></param>
 /// <returns></returns>
 public static bool CreateCollectionIfNotExist <T>(this IArangoDatabase arangoDatabase) where T : GraphBase
 {
     try
     {
         arangoDatabase.CreateCollection(typeof(T).Name, type: typeof(VertexBase).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo()) ? CollectionType.Document : CollectionType.Edge);
         return(true);
     }
     catch (Exception ex)
     {
         if (ex.Message.Contains("duplicate name"))
         {
             return(false);
         }
         else
         {
             throw ex;
         }
     }
 }
Exemplo n.º 3
0
 public void createCollection(string name)
 {
     var createResult = db.CreateCollection(name);
 }