Пример #1
0
        public TemplateSurrogate Build(Template template)
        {
            var componentBuilder = new SurrogateBuildingComponentVisitor();
            var amendmentBuilder = new SurrogateBuildingAmendmentVisitor();

            return(new TemplateSurrogate
            {
                Components = template.Components.Select(c => c.Accept(componentBuilder)).ToArray(),
                Amendments = template.Amendments.Select(a => a.Accept(amendmentBuilder)).ToArray()
            });
        }
        public WidgetSpecificationSurrogate Build(WidgetSpecification widgetSpecification)
        {
            var componentBuilder = new SurrogateBuildingComponentVisitor();
            var amendmentBuilder = new SurrogateBuildingAmendmentVisitor();

            return(new WidgetSpecificationSurrogate
            {
                Category = widgetSpecification.Category,
                Components = widgetSpecification.Components.Select(c => c.Accept(componentBuilder)).ToArray(),
                Amendments = widgetSpecification.Amendments.Select(a => a.Accept(amendmentBuilder)).ToArray(),
                PropertySpecifications = widgetSpecification.Properties.Select(s =>
                                                                               new PropertySpecificationSurrogate
                {
                    Name = s.Name,
                    Type = s.Type,
                    DefaultValue = s.DefaultValue
                }).ToArray()
            });
        }