Beispiel #1
0
        private SingleEdgeUpdateDefinition CreateSingleEdgeUpdateDefinition(ISingleEdge iSingleEdge)
        {
            var sourceVertex = iSingleEdge.GetSourceVertex();
            var targetVertex = iSingleEdge.GetTargetVertex();
            var structuredProperties = iSingleEdge.GetAllProperties();
            var unstructuredProperties = iSingleEdge.GetAllUnstructuredProperties();

            return new SingleEdgeUpdateDefinition(
                new VertexInformation(sourceVertex.VertexTypeID, sourceVertex.VertexID, sourceVertex.VertexRevisionID, sourceVertex.EditionName),
                new VertexInformation(targetVertex.VertexTypeID, targetVertex.VertexID, targetVertex.VertexRevisionID, targetVertex.EditionName),
                iSingleEdge.EdgeTypeID,
                iSingleEdge.Comment,
                new StructuredPropertiesUpdate(
                    structuredProperties != null && structuredProperties.Count() > 0 ? structuredProperties.ToDictionary(key => key.PropertyID, value => value.Property) : null),
                new UnstructuredPropertiesUpdate(
                    unstructuredProperties != null && unstructuredProperties.Count() > 0 ? unstructuredProperties.ToDictionary(key => key.PropertyName, value => value.Property) : null));
        }
Beispiel #2
0
        private IDictionary<string, object> GetEdgeProperties(ISingleEdge aSingleEdge, IEdgeType myInnerEdgeType)
        {
            Dictionary<String, Object> result = new Dictionary<string, object>();

            #region properties

            if (myInnerEdgeType != null)
            {
                foreach (var aProperty in myInnerEdgeType.GetPropertyDefinitions(true))
                {
                    if (aSingleEdge.HasProperty(aProperty.ID))
                    {
                        result.Add(aProperty.Name, aProperty.GetValue(aSingleEdge));
                    }
                    else
                    {
                        var tempResult = aProperty.GetValue(aSingleEdge);

                        if (tempResult != null)
                        {
                            result.Add(aProperty.Name, tempResult);
                        }
                    }
                }
            }

            #endregion

            #region unstructured data

            foreach (var aUnstructuredProperty in aSingleEdge.GetAllUnstructuredProperties())
            {
                result.Add(aUnstructuredProperty.PropertyName, aUnstructuredProperty.Property);
            }

            #endregion

            return result;
        }