示例#1
0
        public XElement Parse()
        {
            var types = GetTypes();

            try
            {
                _current = this;
                return(new XElement("Domain", ParseChildren(types)));
            }
            finally
            {
                _current = null;
            }
        }
示例#2
0
        static void Main()
        {
            var r = new BuildingBlockRecognizer();
            var p = new DomainProcessor(
                new BoundedContextProcessor(r,
                                            new GroupingProcessor("Commands",
                                                                  new CommandProcessor(r)
                                                                  ),
                                            new GroupingProcessor("Domain",
                                                                  new AggregateProcessor(r),
                                                                  new ValueObjectProcessor(r),
                                                                  new DomainEventProcessor(r),
                                                                  new RepositoryProcessor(r),
                                                                  new ServiceProcessor(r),
                                                                  new FactoryProcessor(r)),
                                            new SagaProcessor(r)
                                            ));

            p.AddAssemblyOfType <Invoice>();
            p.AddAssemblyOfType <OrderCreatedEvent>();
            p.AddAssemblyOfType <Customer>();
            p.AddAssemblyOfType <CustomerStatusChangedEvent>();
            p.AddAssemblyOfType <Shipment>();
            p.AddAssemblyOfType <OrderShippedEvent>();
            p.AddAssemblyOfType <Money>();

            XElement xml = p.Parse();


            //  Console.WriteLine(xml);

            var builder = new DomainSvgBuilder();
            var svg     = builder.CreateDocument().ToString();
            var script  = File.ReadAllText("script.html");

            svg = svg.Insert(svg.IndexOf("</style>") + 8, script);

            // Console.WriteLine(svg);
            File.WriteAllText("a.svg", svg);
        }