Example #1
0
        static SyntaxNode AddOrUpdateTransitionResultClass(SyntaxNode documentRoot, StateMachineModel names)
        {
            documentRoot = documentRoot.AddOrUpdateClass(names.TransitionResultClassName, c => c.Public().Abstract().AddMembers(), c => c);

            var baseList = SyntaxFactory.SimpleBaseType(SyntaxFactory.ParseTypeName(names.TransitionResultClassName));

            documentRoot = documentRoot.AddOrUpdateClass(names.TransitionResultTransitionClassName, c => c.Public().AddBaseListTypes(baseList), c => c
                                                         .AddPropertyIfNotExists(names.BaseInterfaceName, "Source", p => p.WithGetter())
                                                         .AddPropertyIfNotExists(names.BaseInterfaceName, "Destination", p => p.WithGetter())
                                                         .AddPropertyIfNotExists(names.ParameterInterfaceName, "Trigger", p => p.WithGetter())
                                                         .WithConstructorFromGetOnlyProperties()
                                                         );

            documentRoot = documentRoot.AddOrUpdateClass(names.TransitionResultInvalidTriggerClassName, c => c.Public().AddBaseListTypes(baseList), c => c
                                                         .AddPropertyIfNotExists(names.BaseInterfaceName, "Source", p => p.WithGetter())
                                                         .AddPropertyIfNotExists(names.ParameterInterfaceName, "Trigger", p => p.WithGetter())
                                                         .WithConstructorFromGetOnlyProperties()
                                                         );

            return(documentRoot);
        }