コード例 #1
0
        public GraphSonUtility(GraphSonMode mode, IElementFactory factory, ElementPropertyConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            _vertexPropertyKeys   = config.VertexPropertyKeys;
            _edgePropertyKeys     = config.EdgePropertyKeys;
            _vertexPropertiesRule = config.VertexPropertiesRule;
            _edgePropertiesRule   = config.EdgePropertiesRule;

            _mode             = mode;
            _factory          = factory;
            _hasEmbeddedTypes = mode == GraphSonMode.EXTENDED;

// ReSharper disable PossibleMultipleEnumeration
            _includeReservedVertexId = IncludeReservedKey(mode, GraphSonTokens.Id, _vertexPropertyKeys,
                                                          _vertexPropertiesRule);
            _includeReservedEdgeId     = IncludeReservedKey(mode, GraphSonTokens.Id, _edgePropertyKeys, _edgePropertiesRule);
            _includeReservedVertexType = IncludeReservedKey(mode, GraphSonTokens.UnderscoreType, _vertexPropertyKeys,
                                                            _vertexPropertiesRule);
            _includeReservedEdgeType = IncludeReservedKey(mode, GraphSonTokens.UnderscoreType, _edgePropertyKeys,
                                                          _edgePropertiesRule);
            _includeReservedEdgeLabel = IncludeReservedKey(mode, GraphSonTokens.Label, _edgePropertyKeys,
                                                           _edgePropertiesRule);
            _includeReservedEdgeOutV = IncludeReservedKey(mode, GraphSonTokens.OutV, _edgePropertyKeys,
                                                          _edgePropertiesRule);
            _includeReservedEdgeInV = IncludeReservedKey(mode, GraphSonTokens.InV, _edgePropertyKeys,
                                                         _edgePropertiesRule);
// ReSharper restore PossibleMultipleEnumeration
        }
コード例 #2
0
 /// <summary>
 ///     A GraphSONUtility that includes the specified properties.
 /// </summary>
 public GraphSonUtility(GraphSonMode mode, IElementFactory factory,
                        IEnumerable <string> vertexPropertyKeys, IEnumerable <string> edgePropertyKeys) :
     this(
         mode, factory,
         ElementPropertyConfig.IncludeProperties(vertexPropertyKeys, edgePropertyKeys))
 {
 }