Пример #1
0
        private static async Task ExecuteGremlinServerQueryAsync(GremlinClient gClient, string query)
        {
            try {
                IEnumerable <dynamic> results =
                    await GremlinClientExtensions.SubmitAsync <dynamic>(gClient, requestScript : query);

                foreach (dynamic result in results)
                {
                    Console.WriteLine(result.ToString());
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("GraphRuntimeException") && ex.Message.Contains("Add Vertex") && ex.Message.Contains("Partition key property must be provided"))
                {
                    Console.WriteLine("Add Vertex failed, as partition key property was not specified while adding a vertex to a partitioned graph.");
                }
                else
                {
                    throw;
                }
            }

            Console.WriteLine("---------------------------------------------------------------------");
        }
        private static void ExecuteGremlinServerQuery(GremlinClient gClient, string query)
        {
            IEnumerable <dynamic> result =
                GremlinClientExtensions.SubmitAsync <dynamic>(gClient, requestScript: query).Result;

            Console.WriteLine(result.First().ToString());
        }