Example #1
0
        public void Start()
        {
            CSVSource sourceOrderData = new CSVSource("src/DataFlow/DemoData.csv");

            sourceOrderData.Configuration.Delimiter = ";";
            RowTransformation <string[], Order> transIntoObject = new RowTransformation <string[], Order>(CSVIntoObject);
            DBSource <Customer>             sourceCustomerData  = new DBSource <Customer>(CustomerTableDef);
            LookupCustomerKey               lookupCustKeyClass  = new LookupCustomerKey();
            Lookup <Order, Order, Customer> lookupCustomerKey   = new Lookup <Order, Order, Customer>(
                lookupCustKeyClass.FindKey, sourceCustomerData, lookupCustKeyClass.LookupData);

            Multicast <Order>     multiCast      = new Multicast <Order>();
            DBDestination <Order> destOrderTable = new DBDestination <Order>(OrderDataTableDef);

            BlockTransformation <Order>       blockOrders        = new BlockTransformation <Order>(BlockTransformOrders);
            DBDestination <Rating>            destRating         = new DBDestination <Rating>(CustomerRatingTableDef);
            RowTransformation <Order, Rating> transOrderIntoCust = new RowTransformation <Order, Rating>(OrderIntoRating);
            CustomDestination <Order>         destSink           = new CustomDestination <Order>(row => {; });

            sourceOrderData.LinkTo(transIntoObject);
            transIntoObject.LinkTo(lookupCustomerKey);

            lookupCustomerKey.LinkTo(multiCast);
            multiCast.LinkTo(destOrderTable);

            multiCast.LinkTo(blockOrders);
            blockOrders.LinkTo(transOrderIntoCust, ord => ord.Rating != null);
            blockOrders.LinkTo(destSink, ord => ord.Rating == null);
            transOrderIntoCust.LinkTo(destRating);

            sourceOrderData.ExecuteAsync();
            destOrderTable.Wait();
            destRating.Wait();
        }