Exemplo n.º 1
0
        private void AssignCollection(NodeAssignment assignment)
        {
            var firstNode   = assignment.Assignment.Values.First();
            var mutableUnit = new MutablePipelineUnit(firstNode, firstNode.Instance);

            pipeline.Handle(assignment.Instance, assignment.Assignment.Member, mutableUnit, null, null);

            if (mutableUnit.Handled)
            {
                return;
            }

            var parent = assignment.Assignment.Member.GetValue(assignment.Instance);

            IEnumerable <object> children;
            var mutableValue = mutableUnit.Value as IEnumerable <object>;

            if (mutableValue != null)
            {
                children = mutableValue;
            }
            else
            {
                children = from n in assignment.Assignment.Values select n.Instance;
            }

            foreach (var child in children)
            {
                Collection.UniversalAdd(parent, child);
            }
        }
Exemplo n.º 2
0
        private void SetMember(Assignment assignment, ConstructionNode parentNode, INodeToObjectBuilder builder, BuilderContext context)
        {
            var mutableUnit = new MutablePipelineUnit(parentNode, assignment.Value);

            pipeline.Handle(assignment.Target.Instance, assignment.Member, mutableUnit, builder, context);
            if (mutableUnit.Handled)
            {
                return;
            }

            assignment.Member.SetValue(assignment.Target.Instance, mutableUnit.Value);
        }