Exemple #1
0
        public static IConnectorLinker <T> Conditional <T>(this IConnectorLinker <T> parent, Predicate <T> predicate, Action <IConnectorLinker <T> > buildChain)
        {
            var connector = new ConditionalSubChainConnector <T>(predicate, buildChain, parent.Context);

            parent.Link(connector);
            return(connector);
        }
        internal static IConnectorLinker <T> TestDelay <T>(
            this IConnectorLinker <T> parent,
            int millisecondsDelay)
        {
            var next = new DelayConnector <T>(millisecondsDelay, parent.Context);

            return(parent.Link(next));
        }
Exemple #3
0
        public static IConnectorLinker <TOutput> Map <T, TOutput>(this IConnectorLinker <T> parent,
                                                                  MapperDelegate <T, TOutput> mapper)
        {
            var connector = new MappingConnector <T, TOutput>(mapper, parent.Context);

            parent.Link(connector);
            return(connector);
        }
Exemple #4
0
 public override void ConfigureRootConnector(IConnectorLinker <Signal> root)
 {
     root.Link <GetLoanInquiry, LoanInquiry>()
     .Link <CreateLoanApplication, LoanApplication>()
     .Conditional(CreditScoreIsBad, builder => builder
                  .Link <DenyLoan, Signal>()
                  .Complete("Denied")
                  )
     .Link <CreateLoanContract, LoanContract>()
     .Link <ApproveLoan, Signal>();
 }
Exemple #5
0
 public override void ConfigureRootConnector(IConnectorLinker <Signal> root)
 {
     root.Link <GetLoanInquiry, LoanInquiry>()
     .Link <CreateLoanApplication, LoanApplication>()
     .If(application => !CreditScoreIsValid(application), then => then
         .Link <DenyLoan, Signal>()
         )
     .If(CreditScoreIsValid, then => then
         .Link <CreateLoanContract, LoanContract>()
         .Link <ApproveLoan, Signal>()
         );
 }
        internal static IConnectorLinker <T> TestInspect <T>(
            this IConnectorLinker <T> parent,
            InitAction?onInit           = null,
            ProcessAction <T>?onProcess = null,
            DisposeAction?onDispose     = null)
        {
            var next = new TestInspectConnector <T>(onInit, parent.Context)
            {
                ProcessAction = onProcess,
                DisposeAction = onDispose
            };

            return(parent.Link(next));
        }
Exemple #7
0
        public static IConnectorLinker <IReadOnlyList <T> > Each <T>(this IConnectorLinker <IReadOnlyList <T> > parent, Action <IConnectorLinker <T> > buildChain)
        {
            var connector = new EnumerationConnector <T>(buildChain, parent.Context);

            return(parent.Link(connector));
        }
Exemple #8
0
        public static void Complete <T>(this IConnectorLinker <T> parent, string reason)
        {
            var connector = new CompletionConnector <T>(reason, parent.Context);

            parent.Link(connector);
        }
Exemple #9
0
        public static IConnectorLinker <T> SubChain <T>(this IConnectorLinker <T> parent, Action <IConnectorLinker <T> > buildChain)
        {
            var connector = new SubChainConnector <T>(buildChain, parent.Context);

            return(parent.Link(connector));
        }
Exemple #10
0
 public override void ConfigureRootConnector(IConnectorLinker <Order> root)
 {
     root.Link <PrintOrderToConsole, Order>();
 }