示例#1
0
        /// <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());
        }
示例#2
0
        /// <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));
        }
示例#3
0
        /// <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());
        }
示例#4
0
 /// <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));
 }
示例#5
0
 /// <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()));
 }
示例#6
0
 /// <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()));
 }
示例#7
0
 /// <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));
 }
示例#8
0
 /// <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()));
 }
示例#9
0
        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);
        }