internal async Task ReadEdgeStateAsync(GrainReference grainReference, EdgeState edgeState) { var graphElementGrain = grainReference.AsReference <IGraphElementGrain>(); var readExpression = $"g.E('{grainReference.ToKeyString()}')"; var feedOptions = new FeedOptions { MaxItemCount = 1, PartitionKey = new PartitionKey(graphElementGrain.GetGraphPartition()) }; var readQuery = client.CreateGremlinQuery <CosmosDbEdge>(graph, readExpression, feedOptions, GraphSONMode.Normal); var response = await readQuery.ExecuteNextAsync <CosmosDbEdge>(); log.Info($"CosmosDB: Read Edge State: Request Charge: {response.RequestCharge}"); var edge = response.FirstOrDefault(); if (edge == null) { return; } edgeState.Persisted = true; var inV = grainReferenceConverter.GetGrainFromKeyString(edge.InVertexId.ToString()); var outV = grainReferenceConverter.GetGrainFromKeyString(edge.OutVertexId.ToString()); inV.BindGrainReference(grainFactory); outV.BindGrainReference(grainFactory); edgeState.SetInVertex(inV.AsReference <IVertex>()); edgeState.SetOutVertex(outV.AsReference <IVertex>()); foreach (var property in edge.GetProperties()) { if (property.Key[0] == '@' || property.Key == "partition") { continue; } edgeState[property.Key] = property.Value.ToString(); } }