Пример #1
0
        private ConstructionNode ProcessNode(XElement node, IPrefixAnnotator annotator)
        {
            var elementType = resolver.LocateType(node.Name);
            var directives  = directiveExtractor.GetDirectives(node).ToList();

            var type = GetFinalTypeAccordingToDirectives(elementType, directives);

            var rawAssigments = assignmentExtractor.GetAssignments(type, node, annotator).ToList();

            var attributeBasedInstanceProperties = CombineDirectivesAndAssigments(type, directives, rawAssigments);

            var children = GetChildren(type, node, annotator);

            var ctorArgs = GetCtorArgs(node, type);

            var constructionNode = new ConstructionNode(elementType)
            {
                Name                = attributeBasedInstanceProperties.Name,
                Key                 = attributeBasedInstanceProperties.Key,
                Assignments         = attributeBasedInstanceProperties.Assignments,
                InjectableArguments = ctorArgs,
                Children            = children,
                InstantiateAs       = type == elementType ? null : type,
            };

            AnnotatePrefixes(node, annotator, constructionNode);

            return(constructionNode);
        }