コード例 #1
0
        private static IVertexResult CreateInsertExpression(GrainReference grainReference, VertexState vertexState, IGraphElementGrain graphElementGrain)
        {
            var insertExpression = g.AddV(graphElementGrain.GetGraphLabel())
                                   .property("id", grainReference.ToKeyString());

            var partition = graphElementGrain.GetGraphPartition();

            if (!string.IsNullOrEmpty(partition))
            {
                insertExpression = insertExpression.property("partition", partition);
            }

            return(insertExpression.property(vertexState));
        }
コード例 #2
0
        private static IEdgeResult CreateInsertExpression(GrainReference grainReference, EdgeState edgeState, IGraphElementGrain graphElementGrain)
        {
            var inVertex  = edgeState.GetInVertex();
            var outVertex = edgeState.GetOutVertex();

            var inVertexKeyString  = inVertex.ToKeyString();
            var outVertexKeyString = outVertex.ToKeyString();

            var insertExpression = g.V(inVertexKeyString)
                                   .addE(graphElementGrain.GetGraphLabel())
                                   .to(g.V(outVertexKeyString))
                                   .property("id", grainReference.ToKeyString());

            var partition = graphElementGrain.GetGraphPartition();

            if (!string.IsNullOrEmpty(partition))
            {
                insertExpression = insertExpression.property("partition", partition);
            }

            return(insertExpression.property(edgeState, p => (p.Key, p.Value)));
        }