コード例 #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()
            });
        }
コード例 #2
0
        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()
            });
        }