protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     base.CacheMetadata(metadata);
     metadata.AddImplementationVariable(_resumeBookmark);
     metadata.AddImplementationVariable(_bodyError);
     metadata.AddDefaultExtensionProvider(() => new CriticalSectionQueueExtension());
 }
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     this.internalStateFuncs.Clear();
     this.internalStates.Clear();
     this.PassNumber++;
     this.TraverseViaTransitions(new Action<System.Activities.Statements.State>(StateMachine.ClearState), new Action<Transition>(StateMachine.ClearTransition));
     this.PassNumber++;
     bool checkReached = false;
     this.TraverseStates((m, states) => ClearStates(states), (m, state) => ClearTransitions(state), metadata, checkReached);
     this.PassNumber++;
     bool flag2 = false;
     this.TraverseStates(new Action<NativeActivityMetadata, Collection<System.Activities.Statements.State>>(this.MarkStatesViaChildren), (m, state) => MarkTransitionsInState(state), metadata, flag2);
     this.PassNumber++;
     this.TraverseViaTransitions(state => MarkStateViaTransition(state), null);
     this.PassNumber++;
     Action<Transition> actionForTransition = null;
     this.TraverseViaTransitions(state => ValidateTransitions(metadata, state), actionForTransition);
     this.PassNumber++;
     NativeActivityMetadata metadata2 = metadata;
     bool flag3 = true;
     this.TraverseStates(new Action<NativeActivityMetadata, Collection<System.Activities.Statements.State>>(StateMachine.ValidateStates), delegate (NativeActivityMetadata m, System.Activities.Statements.State state) {
         if (!state.Reachable)
         {
             ValidateTransitions(m, state);
         }
     }, metadata2, flag3);
     this.ValidateStateMachine(metadata);
     this.ProcessStates(metadata);
     metadata.AddImplementationVariable(this.eventManager);
     foreach (Variable variable in this.Variables)
     {
         metadata.AddVariable(variable);
     }
     metadata.AddDefaultExtensionProvider<StateMachineExtension>(getDefaultExtension);
 }
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     RuntimeArgument argument = new RuntimeArgument("Duration", typeof(TimeSpan), ArgumentDirection.In, true);
     metadata.Bind(this.Duration, argument);
     metadata.SetArgumentsCollection(new Collection<RuntimeArgument> { argument });
     metadata.AddImplementationVariable(this.timerBookmark);
     metadata.AddDefaultExtensionProvider<TimerExtension>(getDefaultTimerExtension);
 }
Esempio n. 4
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            base.CacheMetadata(metadata);

            metadata.AddImplementationVariable(this.timerExpiredBookmark);

            // Because of this statement, it is not required to add the DurableTimerExtension to the WorkflowApplication.Extensions
            // collection to get durable timers support. It is a good idea to do this with activities that REQUIRE extensions to function properly.
            metadata.AddDefaultExtensionProvider(new Func <TimerExtension>(() => { return(new DurableTimerExtension()); }));
        }
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     this.NoPersistHandle = new Variable <NoPersistHandle>();
     this.Bookmark        = new Variable <Bookmark>();
     metadata.AddImplementationVariable(this.NoPersistHandle);
     metadata.AddImplementationVariable(this.Bookmark);
     metadata.RequireExtension <BookmarkResumptionHelper>();
     metadata.AddDefaultExtensionProvider <BookmarkResumptionHelper>(() => new BookmarkResumptionHelper());
     base.CacheMetadata(metadata);
 }
Esempio n. 6
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument durationArgument = new RuntimeArgument("Duration", typeof(TimeSpan), ArgumentDirection.In, true);

            metadata.Bind(this.Duration, durationArgument);
            metadata.SetArgumentsCollection(new Collection <RuntimeArgument> {
                durationArgument
            });
            metadata.AddImplementationVariable(this.timerBookmark);
            metadata.AddDefaultExtensionProvider(getDefaultTimerExtension);
        }
Esempio n. 7
0
        //protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        //{
        //    metadata.AllowUpdateInsideThisActivity();
        //}

        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            metadata.SetVariablesCollection(this.Variables);

            metadata.SetImplementationVariablesCollection(
                new Collection <Variable>
            {
                _currentCompensationId,
                _currentCompensationToken,

                // Add the variables which are only used by the secondary root
                _compensationId
            });

            if (this.Body != null)
            {
                metadata.SetChildrenCollection(new Collection <Activity> {
                    this.Body
                });
            }

            // Declare the handlers as public children.
            if (this.CompensationHandler != null)
            {
                metadata.AddImportedChild(this.CompensationHandler);
            }

            if (this.ConfirmationHandler != null)
            {
                metadata.AddImportedChild(this.ConfirmationHandler);
            }

            if (this.CancellationHandler != null)
            {
                metadata.AddImportedChild(this.CancellationHandler);
            }

            Collection <Activity> implementationChildren = new Collection <Activity>();

            if (!this.IsSingletonActivityDeclared(CompensationActivityStrings.WorkflowImplicitCompensationBehavior))
            {
                WorkflowCompensationBehavior workflowCompensationBehavior = new WorkflowCompensationBehavior();
                this.DeclareSingletonActivity(CompensationActivityStrings.WorkflowImplicitCompensationBehavior, workflowCompensationBehavior);
                implementationChildren.Add(workflowCompensationBehavior);

                metadata.AddDefaultExtensionProvider(CreateCompensationExtension);
            }

            // Clear the cached handler values as workflow definition could be updated.
            CompensationParticipant = null;
            implementationChildren.Add(CompensationParticipant);

            metadata.SetImplementationChildrenCollection(implementationChildren);
        }
Esempio n. 8
0
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     metadata.AddChild(this.RepeatForever);
     foreach (Activity current in this.Triggers)
     {
         metadata.AddChild(current);
     }
     metadata.RequireExtension <BookmarkResumptionHelper>();
     base.CacheMetadata(metadata);
     metadata.AddDefaultExtensionProvider <BookmarkResumptionHelper>(() => new BookmarkResumptionHelper());
 }
Esempio n. 9
0
        /// <summary>
        /// Add activities, variables and argument to metadata
        /// </summary>
        /// <param name="metadata">Metadata</param>
        private void SetupMetadata(NativeActivityMetadata metadata)
        {
            metadata.AddDelegate(OnInit);
            metadata.AddDelegate(OnComplete);
            metadata.AddImplementationChild(_approveSequence);
            metadata.AddDefaultExtensionProvider(() => new WorkflowStateData());
            metadata.AddImplementationVariable(DelaySpan);
            var argAssignTo = new RuntimeArgument("AssignResultTo", typeof(string), ArgumentDirection.Out);

            metadata.Bind(AssignResultTo, argAssignTo);
            metadata.AddArgument(argAssignTo);
        }
        public void CacheMetadata(NativeActivityMetadata metadata)
        {
            _noPersistHandle         = new Variable <NoPersistHandle>();
            _cancellationTokenSource = new Variable <CancellationTokenSource>();
            _bookmarkResumed         = new Variable <bool>();

            metadata.AddImplementationVariable(_noPersistHandle);
            metadata.AddImplementationVariable(_cancellationTokenSource);
            metadata.AddImplementationVariable(_bookmarkResumed);
            metadata.RequireExtension <BookmarkResumptionHelper>();
            metadata.AddDefaultExtensionProvider(BookmarkResumptionHelper.Create);
        }
Esempio n. 11
0
            protected override void CacheMetadata(NativeActivityMetadata metadata)
            {
                // Tell the runtime that we need this extension
                metadata.RequireExtension(typeof(WaiterExtension));

                // Provide a Func to create the extension if it does not already exist
                metadata.AddDefaultExtensionProvider(() => new WaiterExtension());

                metadata.AddArgument(new RuntimeArgument("Waiter", typeof(Waiter), ArgumentDirection.In, true));
                metadata.AddArgument(new RuntimeArgument("Result", typeof(object), ArgumentDirection.Out, false));
                metadata.AddImplementationVariable(_noPersistHandle);
            }
        /// <summary>
        /// Creates and validates a description of the activity’s arguments, variables, child activities, and activity delegates.
        /// </summary>
        /// <param name="metadata">The activity’s metadata that encapsulates the activity’s arguments, variables, child activities, and activity delegates.</param>
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            // Tell the runtime that we need this extension
            metadata.RequireExtension(typeof(Hosting.FolderWatcherExtension));

            // Provide a Func<T> to create the extension if it does not already exist
            metadata.AddDefaultExtensionProvider(() => new Hosting.FolderWatcherExtension());

            metadata.AddArgument(new RuntimeArgument("WatchFolder", typeof(string), ArgumentDirection.In, true));
            metadata.AddArgument(new RuntimeArgument("WatchPattern", typeof(string), ArgumentDirection.In));

            metadata.AddImplementationVariable(this.noPersistHandle);
            metadata.AddImplementationVariable(this.bookmarkWatcher);
        }
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     metadata.RequireExtension <BookmarkResumptionHelper>();
     metadata.AddDefaultExtensionProvider <BookmarkResumptionHelper>(() => new BookmarkResumptionHelper());
     metadata.AddArgument(new RuntimeArgument("Path", typeof(string), ArgumentDirection.In, true));
     if (this.ChangeType == "")
     {
         metadata.AddValidationError("Type 为空!");
     }
     if (this._NotifyFilters == "")
     {
         metadata.AddValidationError("Type 为空!");
     }
     base.CacheMetadata(metadata);
 }
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            // Tell the runtime that we need this extension
            metadata.RequireExtension(typeof(Hosting.FolderWatcherExtension));

            // Provide a Func<T> to create the extension if it does not already exist
            metadata.AddDefaultExtensionProvider(() => new Hosting.FolderWatcherExtension());

            if (this.SubscriptionHandle == null)
            {
                metadata.AddValidationError(String.Format(
                    Properties.Resources.SubscriptionHandleCannotBeNull, base.DisplayName));
            }
            metadata.AddArgument(new RuntimeArgument("SubscriptionHandle", typeof(FileChangeSubscriptionHandle), ArgumentDirection.In, true));
            metadata.AddArgument(new RuntimeArgument("WatchFolder", typeof(string), ArgumentDirection.In, true));
            metadata.AddArgument(new RuntimeArgument("WatchPattern", typeof(string), ArgumentDirection.In));
            metadata.AddImplementationVariable(this.bookmark);
        }
Esempio n. 15
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            // Tell the runtime that we need this extension
            metadata.RequireExtension(typeof(Hosting.FolderWatcherExtension));

            // Provide a Func<T> to create the extension if it does not already exist
            metadata.AddDefaultExtensionProvider(() => new Hosting.FolderWatcherExtension());

            if (this.SubscriptionHandle == null)
            {
                metadata.AddValidationError(String.Format(
                                                Properties.Resources.SubscriptionHandleCannotBeNull, base.DisplayName));
            }
            metadata.AddArgument(new RuntimeArgument("SubscriptionHandle", typeof(FileChangeSubscriptionHandle), ArgumentDirection.In, true));
            metadata.AddArgument(new RuntimeArgument("WatchFolder", typeof(string), ArgumentDirection.In, true));
            metadata.AddArgument(new RuntimeArgument("WatchPattern", typeof(string), ArgumentDirection.In));
            metadata.AddImplementationVariable(this.bookmark);
        }
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            this.internalStateFuncs.Clear();
            this.internalStates.Clear();
            this.PassNumber++;
            this.TraverseViaTransitions(new Action <System.Activities.Statements.State>(StateMachine.ClearState), new Action <Transition>(StateMachine.ClearTransition));
            this.PassNumber++;
            bool checkReached = false;

            this.TraverseStates((m, states) => ClearStates(states), (m, state) => ClearTransitions(state), metadata, checkReached);
            this.PassNumber++;
            bool flag2 = false;

            this.TraverseStates(new Action <NativeActivityMetadata, Collection <System.Activities.Statements.State> >(this.MarkStatesViaChildren), (m, state) => MarkTransitionsInState(state), metadata, flag2);
            this.PassNumber++;
            this.TraverseViaTransitions(state => MarkStateViaTransition(state), null);
            this.PassNumber++;
            Action <Transition> actionForTransition = null;

            this.TraverseViaTransitions(state => ValidateTransitions(metadata, state), actionForTransition);
            this.PassNumber++;
            NativeActivityMetadata metadata2 = metadata;
            bool flag3 = true;

            this.TraverseStates(new Action <NativeActivityMetadata, Collection <System.Activities.Statements.State> >(StateMachine.ValidateStates), delegate(NativeActivityMetadata m, System.Activities.Statements.State state) {
                if (!state.Reachable)
                {
                    ValidateTransitions(m, state);
                }
            }, metadata2, flag3);
            this.ValidateStateMachine(metadata);
            this.ProcessStates(metadata);
            metadata.AddImplementationVariable(this.eventManager);
            foreach (Variable variable in this.Variables)
            {
                metadata.AddVariable(variable);
            }
            metadata.AddDefaultExtensionProvider <StateMachineExtension>(getDefaultExtension);
        }
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            metadata.SetVariablesCollection(this.Variables);
            metadata.SetImplementationVariablesCollection(new Collection <Variable> {
                this.currentCompensationId, this.currentCompensationToken, this.compensationId
            });
            if (this.Body != null)
            {
                metadata.SetChildrenCollection(new Collection <Activity> {
                    this.Body
                });
            }
            if (this.CompensationHandler != null)
            {
                metadata.AddImportedChild(this.CompensationHandler);
            }
            if (this.ConfirmationHandler != null)
            {
                metadata.AddImportedChild(this.ConfirmationHandler);
            }
            if (this.CancellationHandler != null)
            {
                metadata.AddImportedChild(this.CancellationHandler);
            }
            Collection <Activity> implementationChildren = new Collection <Activity>();

            if (!base.IsSingletonActivityDeclared("Activities.Compensation.WorkflowImplicitCompensationBehavior"))
            {
                WorkflowCompensationBehavior activity = new WorkflowCompensationBehavior();
                base.DeclareSingletonActivity("Activities.Compensation.WorkflowImplicitCompensationBehavior", activity);
                implementationChildren.Add(activity);
                metadata.AddDefaultExtensionProvider <CompensationExtension>(new Func <CompensationExtension>(this.CreateCompensationExtension));
            }
            this.CompensationParticipant = null;
            implementationChildren.Add(this.CompensationParticipant);
            metadata.SetImplementationChildrenCollection(implementationChildren);
        }
Esempio n. 18
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            // Tell the runtime that we need this extension
            metadata.RequireExtension(typeof(Hosting.FileCopyExtension));

            // Provide a Func<T> to create the extension if it does not already exist
            metadata.AddDefaultExtensionProvider(() => new Hosting.FileCopyExtension());

            if (this.StepIncrement < 0 || this.StepIncrement > 100)
            {
                metadata.AddValidationError(Properties.Resources.StepIncrementOutOfRange);
            }

            if (this.OnProgress != null)
            {
                metadata.AddDelegate(this.OnProgress);
            }

            metadata.AddImplementationVariable(this.noPersistHandle);
            metadata.AddImplementationVariable(this.bookmarkProgress);

            metadata.AddArgument(new RuntimeArgument("Source", typeof(string), ArgumentDirection.In, true));
            metadata.AddArgument(new RuntimeArgument("Target", typeof(string), ArgumentDirection.In, true));
        }
Esempio n. 19
0
        /// <summary>
        /// Perform State Machine validation, in the following order:
        /// 1. Mark all states in States collection with an Id.
        /// 2. Traverse all states via declared transitions, and mark reachable states.
        /// 3. Validate transitions, states, and state machine
        /// Finally, declare arguments and variables of state machine, and declare states and transitions as activitydelegates.
        /// </summary>
        /// <param name="metadata">NativeActivityMetadata reference</param>
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            // cleanup
            _internalStateFuncs.Clear();
            _internalStates.Clear();

            // clear Ids and Flags via transitions
            this.PassNumber++;
            this.TraverseViaTransitions(ClearState, ClearTransition);

            // clear Ids and Flags of all containing State references.
            this.PassNumber++;
            this.TraverseStates(
                (NativeActivityMetadata m, Collection <State> states) => { ClearStates(states); },
                (NativeActivityMetadata m, State state) => { ClearTransitions(state); },
                metadata,
                checkReached: false);

            // Mark via states and do some check
            this.PassNumber++;
            this.TraverseStates(
                this.MarkStatesViaChildren,
                (NativeActivityMetadata m, State state) => { MarkTransitionsInState(state); },
                metadata,
                checkReached: false);

            this.PassNumber++;

            // Mark via transition
            this.TraverseViaTransitions(delegate(State state) { MarkStateViaTransition(state); }, null);

            // Do validation via children
            // need not check the violation of state which is not reached
            this.PassNumber++;

            this.TraverseViaTransitions(
                (State state) =>
            {
                ValidateTransitions(metadata, state);
            },
                actionForTransition: null);

            this.PassNumber++;

            this.TraverseStates(
                ValidateStates,
                (NativeActivityMetadata m, State state) =>
            {
                if (!state.Reachable)
                {
                    // log validation for states that are not reachable in the previous pass.
                    ValidateTransitions(m, state);
                }
            },
                metadata: metadata,
                checkReached: true);

            // Validate the root state machine itself
            this.ValidateStateMachine(metadata);
            this.ProcessStates(metadata);

            metadata.AddImplementationVariable(_eventManager);
            foreach (Variable variable in this.Variables)
            {
                metadata.AddVariable(variable);
            }

            metadata.AddDefaultExtensionProvider <StateMachineExtension>(s_getDefaultExtension);
        }
Esempio n. 20
0
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     metadata.AddDefaultExtensionProvider <SimpleExtension>(() => new SimpleExtension());
 }
Esempio n. 21
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            // Tell the runtime that we need this extension
            metadata.RequireExtension(typeof(Hosting.FileCopyExtension));

            // Provide a Func<T> to create the extension if it does not already exist
            metadata.AddDefaultExtensionProvider(() => new Hosting.FileCopyExtension());

            if (this.StepIncrement < 0 || this.StepIncrement > 100)
                metadata.AddValidationError(Properties.Resources.StepIncrementOutOfRange);

            if (this.OnProgress != null) metadata.AddDelegate(this.OnProgress);

            metadata.AddImplementationVariable(this.noPersistHandle);
            metadata.AddImplementationVariable(this.bookmarkProgress);

            metadata.AddArgument(new RuntimeArgument("Source", typeof(string), ArgumentDirection.In, true));
            metadata.AddArgument(new RuntimeArgument("Target", typeof(string), ArgumentDirection.In, true));
        }
Esempio n. 22
0
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     base.CacheMetadata(metadata);
     metadata.AddDefaultExtensionProvider <WorkflowInstanceInfo>(() => new WorkflowInstanceInfo());
 }
Esempio n. 23
0
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     metadata.AddDefaultExtensionProvider(() => new WorkflowStateData());
     base.CacheMetadata(metadata);
 }
Esempio n. 24
0
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     base.CacheMetadata(metadata);
     metadata.AddDefaultExtensionProvider <Helpers.WorkflowInstanceExtensionHelper>(() => new Helpers.WorkflowInstanceExtensionHelper());
 }
Esempio n. 25
0
 /// <summary>
 /// Creates and validates a description of the activity’s arguments, variables, child activities, and activity delegates.
 /// </summary>
 /// <param name="metadata">The activity’s metadata that encapsulates the activity’s arguments, variables, child activities, and activity delegates.</param>
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     metadata.AddDefaultExtensionProvider<IResumeBookmark>(() => new ResumeBookmarkExtension());
     base.CacheMetadata(metadata);
 }
Esempio n. 26
0
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     metadata.AddDefaultExtensionProvider <RestExtension>(() =>
                                                          new RestExtension());
     base.CacheMetadata(metadata);
 }
Esempio n. 27
0
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     base.CacheMetadata(metadata);
     metadata.AddDefaultExtensionProvider<Helpers.WorkflowInstanceExtensionHelper>(() => new Helpers.WorkflowInstanceExtensionHelper());
 }
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     base.CacheMetadata(metadata);
     metadata.AddImplementationVariable(DataListExecutionID);
     metadata.AddDefaultExtensionProvider(() => new WorkflowInstanceInfo());
 }
Esempio n. 29
0
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     metadata.RequireExtension <BookmarkResumptionHelper>();
     metadata.AddDefaultExtensionProvider(() => new BookmarkResumptionHelper());
     base.CacheMetadata(metadata);
 }
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            // Will use config to obtain cache information
            metadata.RequireExtension(typeof (DataCacheFactory));
            metadata.AddDefaultExtensionProvider(() => new DataCacheFactory());

            metadata.RequireExtension(typeof (DataCacheNotificationExtension));
            metadata.AddDefaultExtensionProvider(() => new DataCacheNotificationExtension());

            metadata.AddArgument(new RuntimeArgument("CacheName", typeof (string), ArgumentDirection.In, false));
            metadata.AddArgument(new RuntimeArgument("Operations", typeof (IEnumerable<DataCacheOperationDescriptor>),
                                                     ArgumentDirection.Out, false));
            metadata.AddArgument(new RuntimeArgument("NotificationDescriptor", typeof (DataCacheNotificationDescriptor),
                                                     ArgumentDirection.Out, false));

            metadata.AddImplementationVariable(_noPersistHandle);
        }