Exemple #1
0
        /// <inheritdoc/>
        public override void VisitObjectMember(object container, ObjectDescriptor containerDescriptor, IMemberDescriptor member, object value)
        {
            bool shouldProcessReference;

            if (ShouldDiscardMember(member as MemberDescriptorBase))
            {
                return;
            }

            NotifyNodeConstructing(containerDescriptor, member, out shouldProcessReference);

            // If this member should contains a reference, create it now.
            GraphNode containerNode = GetContextNode();
            IContent  content       = ContentFactory.CreateMemberContent(this, containerNode.Content, member, IsPrimitiveType(member.Type), value, shouldProcessReference);
            var       node          = (GraphNode)currentNodeFactory(member.Name, content, Guid.NewGuid());

            containerNode.AddChild(node);

            if (content.IsReference)
            {
                referenceContents.Add(content);
            }

            PushContextNode(node);
            if (!(content.Reference is ObjectReference))
            {
                // For enumerable references, we visit the member to allow VisitCollection or VisitDictionary to enrich correctly the node.
                Visit(content.Value);
            }
            PopContextNode();

            AvailableCommands.Where(x => x.CanAttach(node.Content.Descriptor, (MemberDescriptorBase)member)).ForEach(node.AddCommand);

            node.Seal();
        }
        /// <inheritdoc/>
        public override void VisitObjectMember(object container, ObjectDescriptor containerDescriptor, IMemberDescriptor member, object value)
        {
            // If this member should contains a reference, create it now.
            var containerNode = (IInitializingObjectNode)GetContextNode();
            var guid          = Guid.NewGuid();
            var content       = (MemberContent)ContentFactory.CreateMemberContent(this, guid, containerNode, member, IsPrimitiveType(member.Type), value);

            containerNode.AddMember(content);

            if (content.IsReference)
            {
                referenceContents.Add(content);
            }

            PushContextNode(content);
            if (content.TargetReference == null)
            {
                // For enumerable references, we visit the member to allow VisitCollection or VisitDictionary to enrich correctly the node.
                Visit(content.Value);
            }
            PopContextNode();

            AvailableCommands.Where(x => x.CanAttach(content.Descriptor, (MemberDescriptorBase)member)).ForEach(content.AddCommand);

            content.Seal();
        }