Esempio n. 1
0
            public async Task <string> RunAsync(string request)
            {
                var t = BusinessLogicChain <string>
                        .New <Step1, string>(request)
                        .Then <Step2, string>()
                        .Then <Step3, string>()
                        .RunAsync();

                return(await t);
            }
Esempio n. 2
0
            public async Task <string> RunAsync(string request)
            {
                var t = BusinessLogicChain <string>
                        .New <Step1, string>(request)
                        .Then <StepSwitcher, SwitcherModel>()
                        .OnStepResult(sm => sm.SwitchResult == Switcher.Switch1, sm => BusinessLogicChain <string> .New <Step2_Switch1, string>(sm))
                        .OnStepResult(sm => sm.SwitchResult == Switcher.Switch2, sm => BusinessLogicChain <string> .New <Step2_Switch2, string>(sm))
                        .Then <Step2_NoSwitch, string>()// no call
                        .RunAsync();

                return(await t);
            }
Esempio n. 3
0
            public async Task <string> RunAsync(string request)
            {
                var t = BusinessLogicChain <string>
                        .New <Step1, string>(request) // cancel
                        .Then <Step2, string>()       // cancel
                        .Then <Step3, string>()       // cancel
                        .Then <Step4, string>()       // fail
                        .Then <Step5, string>()       // not execute
                        .RunAsync();

                return(await t);
            }
Esempio n. 4
0
            public async Task <string> RunAsync(string request)
            {
                var t = BusinessLogicChain <string>
                        .New <Step1, string>(request)
                        .Then <Step2, string>()
                        .Then <Step3, string>()
                        .Then <Step4, string>()
                        .OnException <TestException, string, Step5>(step3Result => BusinessLogicChain <string> .New <Step5, string>(step3Result))
                        .RunAsync();

                return(await t);
            }
        public async Task <List <ISourceVacancy> > RunAsync(Guid?sourceId)
        {
            var result = await BusinessLogicChain <List <ISourceVacancy> >
                         .New <GetSourceFromDb, Source>(sourceId)
                         .Then <LoadFromWebSource, SourceVacanciesModel>()
                         .OnException <HttpRequestException, Source, LoadFromDb>(source =>
                                                                                 BusinessLogicChain <List <ISourceVacancy> >
                                                                                 .New <LoadFromDb, List <ISourceVacancy> >(source)
                                                                                 )
                         .Then <SaveToDb, List <ISourceVacancy> >()
                         .RunAsync(Provider);

            return(result);
        }