コード例 #1
0
        static DefaultActivityDescriptor()
        {
            var typeComparer = new InheritanceTypeComparer();

            activityTypeToGetChildrenFunctionMap = new SortedDictionary <Type, Func <object, ActivityInfo[]> >(typeComparer)
            {
                { typeof(Sequence), a => GetSequenceChildren((Sequence)a) },
                { typeof(If), a => GetIfChildren((If)a) },
                { typeof(Parallel), a => GetParallelChildren((Parallel)a) },
                { typeof(DoWhile), a => GetDoWhileChildren((DoWhile)a) },
                { typeof(While), a => GetWhileChildren((While)a) },
                { typeof(Pick), a => GetPickChildren((Pick)a) },
                { typeof(PickBranch), a => GetPickBranchChildren((PickBranch)a) },
                { typeof(Assign), a => new ActivityInfo[0] },
                { typeof(WriteLine), a => new ActivityInfo[0] },
                { typeof(Delay), a => new ActivityInfo[0] },
                { typeof(ForEach <>), a => GetForEachChildren((dynamic)a) },
                { typeof(ParallelForEach <>), a => GetParallelForEachChildren((dynamic)a) },
                { typeof(Persist), a => new ActivityInfo[0] },
                { typeof(Assign <>), a => new ActivityInfo[0] },
                { typeof(CorrelationScope), a => GetCorrelationScopeChildren((CorrelationScope)a) },
                { typeof(CancellationScope), a => GetCancellationScopeChildren((CancellationScope)a) },
                { typeof(CompensableActivity), a => GetCompensableActivityChildren((CompensableActivity)a) },
                { typeof(TransactionScope), a => GetTransactionScopeChildren((TransactionScope)a) },
                { typeof(NoPersistScope), a => GetNoPersistScopeChildren((NoPersistScope)a) },
                { typeof(Activity), a => GetActivityChildren((Activity)a) },
            };

            supportedActivityTypes = new ReadOnlyCollection <Type>(activityTypeToGetChildrenFunctionMap.Keys.ToList());
        }
コード例 #2
0
        static DefaultActivityViewBuilder()
        {
            // TODO : P2 : Consider sorting the supported types collections instead of the dictionary

            // The comparer is used so that the keys are sorted and the compatible type
            // is found in the correct order but it's probably better to sort the
            // supported types collections instead of the dictionary
            var typeComparer = new InheritanceTypeComparer();

            activityTypeToBuildFunctionMap = new SortedDictionary <Type, Func <object, ActivityView> >(typeComparer)
            {
                { typeof(Sequence), a => BuildSequenceView((Sequence)a) },
                { typeof(Persist), a => BuildHeaderOnlyView((Activity)a) },
                { typeof(If), a => BuildIfView((If)a) },
                { typeof(Parallel), a => BuildParallelView((Parallel)a) },
                { typeof(DoWhile), a => BuildDoWhileView((DoWhile)a) },
                { typeof(While), a => BuildWhileView((While)a) },
                { typeof(Pick), a => BuildPickView((Pick)a) },
                { typeof(PickBranch), a => BuildPickBranchView((PickBranch)a) },
                { typeof(Assign), a => BuildAssignView((Assign)a) },
                { typeof(WriteLine), a => BuildWriteLineView((WriteLine)a) },
                { typeof(Delay), a => BuildDelayView((Delay)a) },
                { typeof(ForEach <>), a => BuildForEachView((dynamic)a) },
                { typeof(ParallelForEach <>), a => BuildParallelForEachView((dynamic)a) },
                { typeof(Assign <>), a => BuildAssignView((dynamic)a) },
                { typeof(AddToCollection <>), a => BuildHeaderOnlyView((Activity)a) },
                { typeof(ClearCollection <>), a => BuildHeaderOnlyView((Activity)a) },
                { typeof(ExistsInCollection <>), a => BuildHeaderOnlyView((Activity)a) },
                { typeof(RemoveFromCollection <>), a => BuildHeaderOnlyView((Activity)a) },
                { typeof(Compensate), a => BuildHeaderOnlyView((Activity)a) },
                { typeof(Confirm), a => BuildHeaderOnlyView((Activity)a) },
                { typeof(Rethrow), a => BuildHeaderOnlyView((Activity)a) },
                { typeof(Throw), a => BuildHeaderOnlyView((Activity)a) },
                { typeof(TerminateWorkflow), a => BuildHeaderOnlyView((Activity)a) },
                { typeof(CorrelationScope), a => BuildCorrelationScopeView((CorrelationScope)a) },
                { typeof(CancellationScope), a => BuildCancellationScopeView((CancellationScope)a) },
                { typeof(CompensableActivity), a => BuildCompensableActivityView((CompensableActivity)a) },
                { typeof(TransactionScope), a => BuildTransactionScopeView((TransactionScope)a) },
                { typeof(NoPersistScope), a => BuildNoPersistScopeView((NoPersistScope)a) },
                //{ typeof (Activity), a => BuildHeaderOnlyView((Activity) a) },
            };

            // TODO : P1 : TryCatch
            // TODO : P1 : InvokeDelegate
            // TODO : P1 : InvokeMethod
            // TODO : P1 : InitializeCorrelation
            // TODO : P1 : Receive
            // TODO : P1 : ReceiveReply
            // TODO : P1 : Send
            // TODO : P1 : SendReply
            // TODO : P1 : TransactedReceiveScope
            // TODO : P1 : Switch<T>
            // TODO : P1 : Interop
            // TODO : P1 : Flow Chart Activities
            // TODO : P1 : State Machine Activities

            supportedActivityTypes = new ReadOnlyCollection <Type>(activityTypeToBuildFunctionMap.Keys.ToList());
        }