Exemplo n.º 1
0
        private async Task Run(GenerateCommandOptionBasic options)
        {
            await RunWorkflow(builder =>
            {
                builder
                .SetStartupDirectoryVariable(options.Directory)
                .InitRequiredVariable()
                .Then <SetVariable>(step =>
                {
                    step.VariableName    = "Option";
                    step.ValueExpression =
                        new JavaScriptExpression <GenerateCommandOptionBasic>($"({options.ToJson()})");
                })
                .Then <SetVariable>(
                    step =>
                {
                    step.VariableName    = "Overwrite";
                    step.ValueExpression = new JavaScriptExpression <bool>("Option.Overwrite");
                })
                .Then <ProjectFinderStep>()
                .Then <ProjectInfoProviderStep>()
                .Then <OpenApiDocumentProviderStep>()

                .Then <PreGenerateStep>()
                .Then <GenerateApiStep>();

                return(builder.Build());
            });
        }
Exemplo n.º 2
0
        private async Task Run(GenerateCommandOptionBasic options)
        {
            await RunWorkflow(builder =>
            {
                builder
                .SetStartupDirectoryVariable(options.Directory)
                .InitRequiredVariable()
                .Then <SetVariable>(step =>
                {
                    step.VariableName    = "Option";
                    step.ValueExpression =
                        new JavaScriptExpression <GenerateCommandOptionBasic>($"({options.ToJson()})");
                })
                .Then <SetVariable>(
                    step =>
                {
                    step.VariableName    = "Overwrite";
                    step.ValueExpression = new JavaScriptExpression <bool>("Option.Overwrite");
                })
                .Then <SetVariable>(
                    step =>
                {
                    step.VariableName    = "PermissionControl";
                    step.ValueExpression = new JavaScriptExpression <bool>("!Option.NoPermissionControl");
                })
                .Then <ProjectFinderStep>()
                .Then <ProjectInfoProviderStep>()
                .Then <OpenApiDocumentProviderStep>()

                .Then <PreGenerateStep>()
                .Then <IfElse>(
                    step => step.ConditionExpression =
                        new JavaScriptExpression <bool>("EmptyModule"),
                    ifElse =>
                {
                    ifElse.When(OutcomeNames.False)
                    .Then <GenerateApiStep>()

                    .Then <PostApiFinderStep>()
                    .Then <GenerateModelStep>()
                    .Then <GenerateCreateViewStep>()
                    .Then <GenerateEditViewStep>()

                    .Then <GetListApiFinderStep>()
                    .Then <GenerateListViewStep>();

                    ifElse.When(OutcomeNames.True)
                    .Then <GenerateEmptyModuleStep>();
                }
                    );

                //.Then<GenerateApiStep>()

                //.Then<PostApiFinderStep>()
                //.Then<GenerateModelStep>()
                //.Then<GenerateCreateViewStep>()
                //.Then<GenerateEditViewStep>()

                //.Then<GetListApiFinderStep>()
                //.Then<GenerateListViewStep>();

                return(builder.Build());
            });
        }