TransactionalNodeService.MetadataContext.GetContextType C# (CSharp) Method

GetContextType() public method

public GetContextType ( ) : MetadataContextType
return MetadataContextType
        public MetadataContextType GetContextType()
        {
            if (NodeUid != null && NodeUid.HasValue && NodeUid.Value != Guid.Empty)
            {
                return MetadataContextType.Node;
            }
            else if (RelationshipUid != null && RelationshipUid.HasValue && RelationshipUid.Value != Guid.Empty)
            {
                return MetadataContextType.Relationship;
            }
            else
            {
                return MetadataContextType.Unknown;
            }
        }

Usage Example

Example #1
0
        public void AttachElements()
        {
            foreach (Descriptor descriptor in Descriptors.Values)
            {
                if (Relationships.ContainsKey(descriptor.RelationshipUid))
                {
                    Relationship relationship = Relationships[descriptor.RelationshipUid];

                    relationship.AddNode(descriptor);
                }
            }

            foreach (Metadata metadata in Metadata.Values)
            {
                MetadataContext metadataContext = new MetadataContext(metadata);

                if (metadataContext.GetContextType() == MetadataContextType.Node && Nodes.ContainsKey(metadata.NodeUid.Value))
                {
                    Node node = Nodes[metadata.NodeUid.Value];

                    node.Metadata.Add(metadataContext, metadata);
                }
                else if (metadataContext.GetContextType() == MetadataContextType.Relationship && Relationships.ContainsKey(metadata.RelationshipUid.Value))
                {
                    Relationship relationship = Relationships[metadata.RelationshipUid.Value];

                    relationship.Metadata.Add(metadataContext, metadata);
                }
            }
        }
All Usage Examples Of TransactionalNodeService.MetadataContext::GetContextType