/// <summary> /// Submits the given traversal query to the <see cref="Gremlin.Net.CosmosDb.IGraphClient"/> /// and returns the result /// </summary> /// <typeparam name="T"></typeparam> /// <param name="graphClient">The graph client.</param> /// <param name="gremlinQuery">The traversal query.</param> /// <param name="serializerSettings">The serializer settings.</param> /// <returns>Returns the result</returns> /// <exception cref="ArgumentNullException">traversal</exception> public static async Task <IReadOnlyCollection <T> > SubmitAsync <T>(this IGraphClient graphClient, string gremlinQuery, JsonSerializerSettings serializerSettings) { var result = await graphClient.SubmitAsync(gremlinQuery); var serializer = JsonSerializer.Create(serializerSettings); return(result.Select(token => token.ToObject <T>(serializer)).ToList()); }
/// <summary> /// Submits the given traversal query to the <see cref="Gremlin.Net.CosmosDb.IGraphClient"/> /// and returns the result /// </summary> /// <typeparam name="T"></typeparam> /// <param name="graphClient">The graph client.</param> /// <param name="traversal">The traversal.</param> /// <param name="serializerSettings">The serializer settings.</param> /// <returns>Returns the result</returns> /// <exception cref="ArgumentNullException">traversal</exception> public static Task <IReadOnlyCollection <T> > SubmitAsync <T>(this IGraphClient graphClient, ITraversal traversal, JsonSerializerSettings serializerSettings) { if (traversal == null) { throw new ArgumentNullException(nameof(traversal)); } var gremlinQuery = traversal.ToGremlinQuery(); return(graphClient.SubmitAsync <T>(gremlinQuery, serializerSettings)); }
/// <summary> /// Submits the given traversal query to the <see cref="Gremlin.Net.CosmosDb.IGraphClient"/> /// and returns the result /// </summary> /// <typeparam name="T"></typeparam> /// <param name="graphClient">The graph client.</param> /// <param name="traversal">The traversal.</param> /// <param name="serializerSettings">The serializer settings.</param> /// <returns>Returns the result</returns> /// <exception cref="ArgumentNullException">traversal</exception> public static async Task <IReadOnlyCollection <T> > SubmitAsync <T>(this IGraphClient graphClient, ITraversal traversal, JsonSerializerSettings serializerSettings) { if (traversal == null) { throw new ArgumentNullException(nameof(traversal)); } var gremlinQuery = traversal.ToGremlinQuery(); var result = await graphClient.SubmitAsync(gremlinQuery); var serializer = JsonSerializer.Create(serializerSettings); return(result.Select(token => token.ToObject <T>(serializer)).ToList()); }
/// <summary> /// Submits the given traversal query to the <see cref="Gremlin.Net.CosmosDb.IGraphClient"/> /// and returns the result /// </summary> /// <typeparam name="S"></typeparam> /// <param name="graphClient">The graph client.</param> /// <param name="traversal">The traversal.</param> /// <returns>Returns the result</returns> /// <exception cref="ArgumentNullException">traversal</exception> public static Task <IReadOnlyCollection <Property> > SubmitAsync <S>(this IGraphClient graphClient, ITraversal <S, Gremlin.Net.Structure.Property> traversal) { return(graphClient.SubmitAsync <Property>(traversal)); }
/// <summary> /// Submits the given traversal query to the <see cref="Gremlin.Net.CosmosDb.IGraphClient"/> /// and returns the result /// </summary> /// <typeparam name="S"></typeparam> /// <typeparam name="E"></typeparam> /// <param name="graphClient">The graph client.</param> /// <param name="traversal">The traversal.</param> /// <returns>Returns the result</returns> /// <exception cref="ArgumentNullException">traversal</exception> public static Task <IReadOnlyCollection <E> > SubmitAsync <S, E>(this IGraphClient graphClient, ISchemaBoundTraversal <S, E> traversal) { return(graphClient.SubmitAsync(traversal, BuildDefaultSerializerSettings())); }
/// <summary> /// Submits the given traversal query to the <see cref="Gremlin.Net.CosmosDb.IGraphClient"/> /// and returns the result /// </summary> /// <typeparam name="T"></typeparam> /// <param name="graphClient">The graph client.</param> /// <param name="traversal">The traversal.</param> /// <returns>Returns the result</returns> /// <exception cref="ArgumentNullException">traversal</exception> public static Task <IReadOnlyCollection <T> > SubmitAsync <T>(this IGraphClient graphClient, ITraversal traversal) { return(graphClient.SubmitAsync <T>(traversal, BuildDefaultSerializerSettings())); }
/// <summary> /// Submits the given traversal query to the <see cref="Gremlin.Net.CosmosDb.IGraphClient"/> /// and returns the result /// </summary> /// <typeparam name="S"></typeparam> /// <typeparam name="E"></typeparam> /// <param name="graphClient">The graph client.</param> /// <param name="traversal">The traversal.</param> /// <param name="serializerSettings">The serializer settings.</param> /// <returns>Returns the result</returns> /// <exception cref="ArgumentNullException">traversal</exception> public static Task <IReadOnlyCollection <E> > SubmitAsync <S, E>(this IGraphClient graphClient, ISchemaBoundTraversal <S, E> traversal, JsonSerializerSettings serializerSettings) { return(graphClient.SubmitAsync <E>(traversal.ToGraphTraversal(), serializerSettings)); }
/// <summary> /// Submits the given query to the <see cref="Gremlin.Net.CosmosDb.IGraphClient"/> /// and returns the result /// </summary> /// <typeparam name="T"></typeparam> /// <param name="graphClient">The graph client.</param> /// <param name="gremlinQuery">The traversal query.</param> /// <returns>Returns the result</returns> /// <exception cref="ArgumentNullException">traversal</exception> public static Task <IReadOnlyCollection <T> > SubmitAsync <T>(this IGraphClient graphClient, string gremlinQuery) { return(graphClient.SubmitAsync <T>(gremlinQuery, BuildDefaultSerializerSettings())); }
private async Task <List <GroupVertex> > FetchGroups() { var t = await client.SubmitAsync <GroupVertex>($"g.V().has('label','GroupVertex')"); var l = new List <GroupVertex>(); foreach (var item in t) { l.Add(item.Entity); } return(l); }