protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            // The Body introduces another layer of scope. Method metadata.AddImplementationChild
            // (instead of metadata.AddChild) enable access to LoopVariable from the inner
            // block scope of Body.
            if (this.Body != null && this.Body.Handler != null)
            {
                this.invokeBody.Action = this.Body;
                metadata.AddImplementationChild(this.invokeBody);
            }

            // Need to bind the arguments to the custom activity variables explicitly
            // and then add them to the metadata.
            RuntimeArgument startArg = new RuntimeArgument("Start", typeof(int), ArgumentDirection.In, true);

            metadata.Bind(this.Start, startArg);
            metadata.AddArgument(startArg);
            RuntimeArgument stopArg = new RuntimeArgument("Stop", typeof(int), ArgumentDirection.In, true);

            metadata.Bind(this.Stop, stopArg);
            metadata.AddArgument(stopArg);
            RuntimeArgument stepArg = new RuntimeArgument("Step", typeof(int), ArgumentDirection.In, true);

            metadata.Bind(this.Step, stepArg);
            metadata.AddArgument(stepArg);

            // Register variables used in the custom activity.
            metadata.AddImplementationVariable(this.loopVariable);
        }
        /// <summary>
        /// The cache metadata.
        /// </summary>
        /// <param name="metadata">
        /// The metadata.
        /// </param>
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            metadata.RequireExtension<IMessagingStub>();

            var parametersContent = this.Content as ReceiveParametersContent;

            if (parametersContent != null)
            {
                foreach (var pair in parametersContent.Parameters)
                {
                    var argument = new RuntimeArgument(pair.Key, pair.Value.ArgumentType, ArgumentDirection.Out);
                    metadata.Bind(pair.Value, argument);
                    metadata.AddArgument(argument);
                }
            }

            var messageContent = this.Content as ReceiveMessageContent;
            if (messageContent != null)
            {
                var runtimeArgumentType = (messageContent.Message == null) ? typeof(object) : messageContent.Message.ArgumentType;
                var argument = new RuntimeArgument("Message", runtimeArgumentType, ArgumentDirection.Out);
                metadata.Bind(messageContent.Message, argument);
                metadata.AddArgument(argument);
            }

            // Note: Not adding other properties here as arguments
        }
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     if (this.Result != null)
     {
         RuntimeArgument argument = new RuntimeArgument("Result", this.Result.ArgumentType, ArgumentDirection.In);
         metadata.Bind(this.Result, argument);
         metadata.AddArgument(argument);
     }
     if (this.parameters != null)
     {
         int num = 0;
         foreach (InArgument argument2 in this.parameters)
         {
             RuntimeArgument argument3 = new RuntimeArgument("Parameter" + num++, argument2.ArgumentType, ArgumentDirection.In);
             metadata.Bind(argument2, argument3);
             metadata.AddArgument(argument3);
         }
     }
     RuntimeArgument argument4 = new RuntimeArgument("Message", System.ServiceModel.Activities.Constants.MessageType, ArgumentDirection.Out, true);
     metadata.Bind(this.Message, argument4);
     metadata.AddArgument(argument4);
     RuntimeArgument argument5 = new RuntimeArgument("CorrelatesWith", System.ServiceModel.Activities.Constants.CorrelationHandleType, ArgumentDirection.In);
     metadata.Bind(this.CorrelatesWith, argument5);
     metadata.AddArgument(argument5);
 }
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            if (this.Result != null)
            {
                RuntimeArgument argument = new RuntimeArgument("Result", this.Result.ArgumentType, ArgumentDirection.In);
                metadata.Bind(this.Result, argument);
                metadata.AddArgument(argument);
            }
            if (this.parameters != null)
            {
                int num = 0;
                foreach (InArgument argument2 in this.parameters)
                {
                    RuntimeArgument argument3 = new RuntimeArgument("Parameter" + num++, argument2.ArgumentType, ArgumentDirection.In);
                    metadata.Bind(argument2, argument3);
                    metadata.AddArgument(argument3);
                }
            }
            RuntimeArgument argument4 = new RuntimeArgument("Message", System.ServiceModel.Activities.Constants.MessageType, ArgumentDirection.Out, true);

            metadata.Bind(this.Message, argument4);
            metadata.AddArgument(argument4);
            RuntimeArgument argument5 = new RuntimeArgument("CorrelatesWith", System.ServiceModel.Activities.Constants.CorrelationHandleType, ArgumentDirection.In);

            metadata.Bind(this.CorrelatesWith, argument5);
            metadata.AddArgument(argument5);
        }
Example #5
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)
        {
            // Add a validation error if the Operation is not defined.
            if (this.Operation == null)
            {
                metadata.AddValidationError("AzureAsyncOperation requires an Azure activity to execute.");
                return;
            }

            // Add the publicly defined activities as children.
            metadata.AddChild(this.Operation);
            metadata.AddChild(this.Success);
            metadata.AddChild(this.Failure);

            // Define internal variables.
            metadata.AddImplementationVariable(this.PollingEndTime);
            metadata.AddImplementationVariable(this.OperationId);
            metadata.AddImplementationVariable(this.AzureActivityExceptionCaught);

            // Define public arguments.
            var thumbArgument = new RuntimeArgument("CertificateThumbprintId", typeof(string), ArgumentDirection.In);

            metadata.Bind(this.CertificateThumbprintId, thumbArgument);
            metadata.AddArgument(thumbArgument);
            var subArgument = new RuntimeArgument("SubscriptionId", typeof(string), ArgumentDirection.In);

            metadata.Bind(this.SubscriptionId, subArgument);
            metadata.AddArgument(subArgument);

            // Add our activities as delegates.
            metadata.AddDelegate(this.PollingBody);
            metadata.AddDelegate(this.DelayBody);
        }
        /// <summary>
        /// Register activity's metadata
        /// </summary>
        /// <param name="metadata"></param>
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            // Register In arguments
            RuntimeArgument dictArg = new RuntimeArgument("SplitedDocument", typeof(SplitedDocument), ArgumentDirection.In);

            metadata.AddArgument(dictArg);
            metadata.Bind(this.SplitedDocument, dictArg);

            // [ParaSenDictionary] Argument must be set
            if (this.SplitedDocument == null)
            {
                metadata.AddValidationError(
                    new System.Activities.Validation.ValidationError(
                        "[SplitedDocument] argument must be set!",
                        false,
                        "SplitedDocument"));
            }
            // Register In arguments
            RuntimeArgument localEpisodeArg = new RuntimeArgument("LocalEpisode", typeof(LocalEpisode), ArgumentDirection.In);

            metadata.AddArgument(localEpisodeArg);
            metadata.Bind(this.LocalEpisode, localEpisodeArg);

            // [ParaSenDictionary] Argument must be set
            if (this.LocalEpisode == null)
            {
                metadata.AddValidationError(
                    new System.Activities.Validation.ValidationError(
                        "[LocalEpisode] argument must be set!",
                        false,
                        "LocalEpisode"));
            }
        }
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument argument = new RuntimeArgument("CorrelatesWith", System.ServiceModel.Activities.Constants.CorrelationHandleType, ArgumentDirection.In);

            metadata.Bind(this.CorrelatesWith, argument);
            metadata.AddArgument(argument);
            if (this.correlationInitializers != null)
            {
                int num = 0;
                foreach (CorrelationInitializer initializer in this.correlationInitializers)
                {
                    if (initializer.CorrelationHandle != null)
                    {
                        RuntimeArgument argument2 = new RuntimeArgument("Parameter" + num, initializer.CorrelationHandle.ArgumentType, initializer.CorrelationHandle.Direction, true);
                        metadata.Bind(initializer.CorrelationHandle, argument2);
                        metadata.AddArgument(argument2);
                        num++;
                    }
                }
            }
            RuntimeArgument argument3 = new RuntimeArgument("Message", System.ServiceModel.Activities.Constants.MessageType, ArgumentDirection.Out);

            metadata.Bind(this.Message, argument3);
            metadata.AddArgument(argument3);
            RuntimeArgument argument4 = new RuntimeArgument("noPersistHandle", System.ServiceModel.Activities.Constants.NoPersistHandleType, ArgumentDirection.In);

            metadata.Bind(this.NoPersistHandle, argument4);
            metadata.AddArgument(argument4);
            metadata.AddImplementationVariable(this.receiveMessageInstance);
            metadata.AddImplementationChild(this.waitForReply);
        }
Example #8
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument argument;

            argument = new RuntimeArgument("JobGuid", typeof(Guid), ArgumentDirection.In);
            metadata.Bind(this.JobGuid, argument);
            metadata.AddArgument(argument);

            argument = new RuntimeArgument("UserGuid", typeof(Guid), ArgumentDirection.In);
            metadata.Bind(this.UserGuid, argument);
            metadata.AddArgument(argument);

            if (this.Try != null)
            {
                metadata.AddChild(this.Try);
            }
            if (this.Finally != null)
            {
                metadata.AddChild(this.Finally);
            }

            argument = new RuntimeArgument("MaxRetries", typeof(int), ArgumentDirection.In);
            metadata.Bind(this.MaxRetries, argument);
            metadata.AddArgument(argument);

            metadata.AddImplementationVariable(this.retries);
        }
Example #9
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            if (GetBatchingStrategyFactory.IsNull()) metadata.AddValidationError("GetBatchingStrategyFactory function is expected.");
            if (GetNextVectors.IsNull()) metadata.AddValidationError("GetNextVectors function is expected.");
            if (ItemCount == null) metadata.AddValidationError("ItemCount expression expected.");

            metadata.AddDelegate(GetBatchingStrategyFactory);
            metadata.AddDelegate(GetNextVectors);
            metadata.AddDelegate(ReinitializeVectorProvider);

            RuntimeArgument arg;

            metadata.AddArgument(arg = new RuntimeArgument("LastResult", typeof(BatchExecutionResult), ArgumentDirection.In));
            metadata.Bind(LastResult, arg);

            metadata.AddArgument(arg = new RuntimeArgument("ReinitializationFrequency", typeof(int), ArgumentDirection.In));
            metadata.Bind(ReinitializationFrequency, arg);

            metadata.AddArgument(arg = new RuntimeArgument("UseCache", typeof(bool), ArgumentDirection.In));
            metadata.Bind(UseCache, arg);

            metadata.AddChild(ItemCount);

            metadata.AddImplementationVariable(cachedVectors);
            metadata.AddImplementationVariable(strategyHasJustInited);

            base.CacheMetadata(metadata);
        }
Example #10
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument argument;

            argument = new RuntimeArgument("JobGuid", typeof(Guid), ArgumentDirection.In);
            metadata.Bind(this.JobGuid, argument);
            metadata.AddArgument(argument);

            argument = new RuntimeArgument("UserGuid", typeof(Guid), ArgumentDirection.In);
            metadata.Bind(this.UserGuid, argument);
            metadata.AddArgument(argument);

            if (this.Try != null)
            {
                metadata.AddChild(this.Try);
            }
            if (this.Finally != null)
            {
                metadata.AddChild(this.Finally);
            }

            argument = new RuntimeArgument("MaxRetries", typeof(int), ArgumentDirection.In);
            metadata.Bind(this.MaxRetries, argument);
            metadata.AddArgument(argument);

            metadata.AddImplementationVariable(this.retries);
        }
Example #11
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            //clean up
            this.internalStates.Clear();
            this.internalStateFuncs.Clear();
            this.internalTransitions.Clear();

            StateMachineHelper.ProcessChildStates(metadata, this.States, this.internalStates, this.internalStateFuncs);

            if (this.Entry != null)
            {
                metadata.AddChild(this.Entry);
            }
            if (this.Exit != null)
            {
                metadata.AddChild(this.Exit);
            }

            ProcessTransitions(metadata);

            metadata.AddArgument(new RuntimeArgument("ToState", this.ToState.ArgumentType, ArgumentDirection.In));
            metadata.AddArgument(new RuntimeArgument("EventManager", this.EventManager.ArgumentType, ArgumentDirection.In));

            metadata.AddImplementationVariable(this.currentRunningTriggers);
            metadata.AddImplementationVariable(this.hasRunningChildState);
            metadata.AddImplementationVariable(this.isExiting);
            metadata.AddImplementationVariable(this.evaluateConditionBookmark);
            metadata.AddImplementationVariable(this.completeStateBookmark);
        }
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            metadata.AddChild(Body);

            // add arguments
            metadata.AddArgument(new RuntimeArgument("Action", typeof(Command?), ArgumentDirection.In, true));
            metadata.AddArgument(new RuntimeArgument("Bookmark", typeof(CustomBookmark), ArgumentDirection.In, false));
            metadata.AddArgument(new RuntimeArgument("BookmarkHistory", typeof(List <CustomBookmark>), ArgumentDirection.InOut, false));
        }
Example #13
0
        /// <summary>
        /// Register activity's metadata
        /// </summary>
        /// <param name="metadata"></param>
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            metadata.RequireExtension <INotifyInitialize>();

            // Register In arguments
            var episodeArg = new RuntimeArgument(nameof(Episode), typeof(XEpisode), ArgumentDirection.In);

            metadata.AddArgument(episodeArg);
            metadata.Bind(this.Episode, episodeArg);

            // [Episode] Argument must be set
            if (this.Episode == null)
            {
                metadata.AddValidationError(
                    new System.Activities.Validation.ValidationError(
                        "[Episode] argument must be set!",
                        false,
                        nameof(Episode)));
            }

            var targetArg = new RuntimeArgument(nameof(Target), typeof(BaseTarget), ArgumentDirection.In);

            metadata.AddArgument(targetArg);
            metadata.Bind(this.Target, targetArg);

            // [Target] Argument must be set
            if (this.Target == null)
            {
                metadata.AddValidationError(
                    new System.Activities.Validation.ValidationError(
                        "[Target] argument must be set!",
                        false,
                        nameof(Target)));
            }


            // Register Out arguments
            var resultArg = new RuntimeArgument("Result", typeof(LocalEpisode), ArgumentDirection.Out);

            metadata.AddArgument(resultArg);
            metadata.Bind(this.Result, resultArg);

            // [Result] Argument must be set
            if (this.Result == null)
            {
                metadata.AddValidationError(
                    new System.Activities.Validation.ValidationError(
                        "[Result] argument must be set!",
                        false,
                        "Result"));
            }

            // TODO : Add arguments ... etc ...
        }
Example #14
0
            protected override void CacheMetadata(NativeActivityMetadata metadata)
            {
                RuntimeArgument argument = new RuntimeArgument("ParentChain", typeof(IEnumerable <Activity>), ArgumentDirection.In, true);

                metadata.Bind(this.ParentChain, argument);
                metadata.AddArgument(argument);
                RuntimeArgument argument2 = new RuntimeArgument("RethrowActivity", typeof(Rethrow), ArgumentDirection.In, true);

                metadata.Bind(this.RethrowActivity, argument2);
                metadata.AddArgument(argument2);
            }
Example #15
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);
            }
Example #16
0
        /// <summary>
        /// Add activities, variables and argument to metadata
        /// </summary>
        /// <param name="metadata">Metadata</param>
        private void SetupMetadata(NativeActivityMetadata metadata)
        {
            metadata.AddImplementationChild(_startWorkflowCatch);
            var workflowIdArgument = new RuntimeArgument("WorkflowId", typeof(string), ArgumentDirection.Out);

            metadata.Bind(WorkflowId, workflowIdArgument);
            metadata.AddArgument(workflowIdArgument);
            var resultArgument = new RuntimeArgument("WorkflowResult", typeof(string), ArgumentDirection.Out);

            metadata.Bind(WorkflowResult, resultArgument);
            metadata.AddArgument(resultArgument);
            metadata.AddImplementationVariable(_currentRequest);
        }
        /// <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);
        }
Example #18
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            metadata.RequireExtension <IMessageAgent>();
            metadata.RequireExtension <IEventBroker>();

            var messageType = new RuntimeArgument("MessageType", typeof(MessageType), ArgumentDirection.In);

            metadata.AddArgument(messageType);
            metadata.Bind(this.MessageType, messageType);

            var key = new RuntimeArgument("Key", typeof(string), ArgumentDirection.In);

            metadata.AddArgument(key);
            metadata.Bind(this.Key, key);
        }
Example #19
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            metadata.AddImplementationVariable(Guess);
            metadata.AddImplementationVariable(Target);

            var maxNumber = new RuntimeArgument("MaxNumber", typeof(int), ArgumentDirection.In, true);

            metadata.Bind(MaxNumber, maxNumber);
            metadata.AddArgument(maxNumber);

            var turns = new RuntimeArgument("Turns", typeof(int), ArgumentDirection.Out, true);

            metadata.Bind(Turns, turns);
            metadata.AddArgument(turns);
        }
Example #20
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            var arg = new RuntimeArgument("ParentChain", typeof(IEnumerable <Activity>), ArgumentDirection.In, isRequired: true);

            metadata.Bind(ParentChain, arg);
            metadata.AddArgument(arg);
        }
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            metadata.SetImplementationVariablesCollection(new Collection <Variable> {
                this.currentCompensationToken
            });
            Collection <Activity> children = new Collection <Activity>();

            if (this.CompensationHandler != null)
            {
                children.Add(this.CompensationHandler);
            }
            if (this.ConfirmationHandler != null)
            {
                children.Add(this.ConfirmationHandler);
            }
            if (this.CancellationHandler != null)
            {
                children.Add(this.CancellationHandler);
            }
            metadata.SetChildrenCollection(children);
            Collection <Activity> implementationChildren = new Collection <Activity> {
                this.DefaultCompensation,
                this.DefaultConfirmation
            };

            metadata.SetImplementationChildrenCollection(implementationChildren);
            RuntimeArgument argument = new RuntimeArgument("CompensationId", typeof(long), ArgumentDirection.In);

            metadata.Bind(this.compensationId, argument);
            metadata.AddArgument(argument);
        }
        /// <summary>
        /// Gets or sets the arguments of the child workflow.
        /// </summary>
        /// <value>
        /// The child arguments.
        /// </value>


        /// <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)
        {
            foreach (string argumentKey in this.ChildArguments.Keys)
            {
                Argument        argument        = this.ChildArguments[argumentKey];
                RuntimeArgument runtimeArgument = new RuntimeArgument(argumentKey, argument.ArgumentType, argument.Direction);
                metadata.Bind(argument, runtimeArgument);
                metadata.AddArgument(runtimeArgument);
            }

            try
            {
                DynamicActivity dynamicActivity = this.LoadDynamicActivityFromCache();

                if (dynamicActivity != null)
                {
                    this.Validate(metadata, dynamicActivity);
                }
                else
                {
                    metadata.AddValidationError(Resources.SpecifyValidWorkflowValidationErrorText);
                }
            }
            catch (Exception ex)
            {
                metadata.AddValidationError(string.Format(Resources.FailedToLoadWorkflowValidationErrorText, ex.Message));
            }
        }
        /// <summary>
        /// Store implementation variables
        /// </summary>
        /// <param name="metadata"></param>
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            // add the arguments to the argument collection
            metadata.AddArgument(new RuntimeArgument("Values", typeof(IEnumerable <T>), ArgumentDirection.In, true));
            metadata.AddArgument(new RuntimeArgument("ThrottleLimit", typeof(int), ArgumentDirection.In));

            // initialize the hasCompleted and valueEnumerator and add it to the list of private variables
            this.hasCompleted = new Variable <bool>();
            metadata.AddImplementationVariable(this.hasCompleted);

            this.valueEnumerator = new Variable <IEnumerator <T> >();
            metadata.AddImplementationVariable(this.valueEnumerator);

            // add the body to the delegates collection
            metadata.AddDelegate(this.Body);
        }
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     //base.CacheMetadata(metadata);
     metadata.AddDelegate(Notify);
     metadata.AddArgument(new RuntimeArgument(
                              "Strings", typeof(List <String>), ArgumentDirection.In));
     metadata.AddImplementationVariable(NextIndex);
 }
Example #25
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument bookmarkValueArgument = new RuntimeArgument("BookmarkValue", typeof(T), ArgumentDirection.Out);

            metadata.Bind(this.BookmarkValue, bookmarkValueArgument);

            metadata.AddArgument(bookmarkValueArgument);
        }
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     metadata.RequireExtension<ICountModel>();
     var currentCountArg = new RuntimeArgument(
         "CurrentCount", typeof(Int32), ArgumentDirection.In);
     metadata.AddArgument(currentCountArg);
     metadata.Bind(this.CurrentCount, currentCountArg);
 }
Example #27
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument valuesArgument = new RuntimeArgument("Values", typeof(IEnumerable), ArgumentDirection.In, true);
            metadata.Bind(this.Values, valuesArgument);

            metadata.AddArgument(valuesArgument);
            metadata.AddDelegate(this.Body);
            metadata.AddImplementationVariable(this.valueEnumerator);
        }
Example #28
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            metadata.AddDelegate(OnRun);

            var runtimeArgument = new RuntimeArgument("TaskCode", typeof(string), ArgumentDirection.In);

            metadata.Bind(TaskCode, runtimeArgument);
            metadata.AddArgument(runtimeArgument);
        }
Example #29
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)
        {
            metadata.RequireExtension <ICountModel>();
            var currentCountArg = new RuntimeArgument(
                "CurrentCount", typeof(Int32), ArgumentDirection.In);

            metadata.AddArgument(currentCountArg);
            metadata.Bind(this.CurrentCount, currentCountArg);
        }
Example #31
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument valuesArgument = new RuntimeArgument("Values", typeof(IEnumerable), ArgumentDirection.In, true);
            metadata.Bind(this.Values, valuesArgument);

            metadata.AddArgument(valuesArgument);
            metadata.AddDelegate(this.Body);
            metadata.AddImplementationVariable(this.valueEnumerator);
        }
        /// <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)
        {
            foreach (var kvp in this.Arguments)
            {
                metadata.AddArgument(new RuntimeArgument(kvp.Key, kvp.Value.ArgumentType, kvp.Value.Direction));
            }

            metadata.SetVariablesCollection(this.Variables);
            metadata.AddChild(this.StateMachine);
        }
        public static void AddRuntimeArgument <T>(
            this NativeActivityMetadata metadata,
            InOutArgument <T> argument,
            string argumentName,
            bool isRequired,
            List <string> overloadGroupNames)
        {
            RuntimeArgument runtimeArgument = new RuntimeArgument(argumentName, typeof(T), ArgumentDirection.InOut, isRequired, overloadGroupNames);

            metadata.Bind((Argument)argument, runtimeArgument);
            metadata.AddArgument(runtimeArgument);
        }
Example #34
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);
        }
Example #35
0
        /// <summary>
        /// Add activities, variables and argument to metadata
        /// </summary>
        /// <param name="metadata">Metadata</param>
        private void SetupMetadata(NativeActivityMetadata metadata)
        {
            metadata.AddImplementationVariable(_request);
            metadata.AddImplementationVariable(_response);
            metadata.AddDelegate(OnCompleting);
            var runtimeArgument = new RuntimeArgument("WfCorrelation", typeof(CorrelationHandle), ArgumentDirection.In);

            metadata.Bind(CorrelationHandle, runtimeArgument);
            metadata.AddArgument(runtimeArgument);
            metadata.AddImplementationChild(_receive);
            metadata.AddImplementationChild(_sendReply);
        }
Example #36
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument argument = new RuntimeArgument("Message", System.ServiceModel.Activities.Constants.MessageType, ArgumentDirection.InOut, true);

            metadata.Bind(this.Message, argument);
            metadata.AddArgument(argument);
            if (this.parameters != null)
            {
                int num = 0;
                foreach (OutArgument argument2 in this.parameters)
                {
                    RuntimeArgument argument3 = new RuntimeArgument("Parameter" + num++, argument2.ArgumentType, ArgumentDirection.Out);
                    metadata.Bind(argument2, argument3);
                    metadata.AddArgument(argument3);
                }
            }
            RuntimeArgument argument4 = new RuntimeArgument("noPersistHandle", System.ServiceModel.Activities.Constants.NoPersistHandleType, ArgumentDirection.In);

            metadata.Bind(this.NoPersistHandle, argument4);
            metadata.AddArgument(argument4);
        }
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument messageArgument = new RuntimeArgument(Constants.Message, Constants.MessageType, ArgumentDirection.InOut, true);
            metadata.Bind(this.Message, messageArgument);
            metadata.AddArgument(messageArgument);

            if (this.parameters != null)
            {
                int count = 0;
                foreach (OutArgument parameter in this.parameters)
                {
                    RuntimeArgument parameterArgument = new RuntimeArgument(Constants.Parameter + count++, parameter.ArgumentType, ArgumentDirection.Out);
                    metadata.Bind(parameter, parameterArgument);
                    metadata.AddArgument(parameterArgument);
                }
            }

            RuntimeArgument noPersistHandleArgument = new RuntimeArgument(Constants.NoPersistHandle, Constants.NoPersistHandleType, ArgumentDirection.In);
            metadata.Bind(this.NoPersistHandle, noPersistHandleArgument);
            metadata.AddArgument(noPersistHandleArgument);
        }
Example #38
0
        /// <summary>
        /// Creates and validates a description of the activity's arguments.
        /// </summary>
        /// <param name="metadata"></param>
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            base.CacheMetadata(metadata);

            // bind arguments collection
            Arguments
            .Select((i, j) => Tuple.Create(i, new RuntimeArgument($"Arg{j}", typeof(object), ArgumentDirection.In)))
            .ForEach(i =>
            {
                metadata.Bind(i.Item1, i.Item2);
                metadata.AddArgument(i.Item2);
            });
        }
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            // child activities
            metadata.AddChild(this.Body);

            // arguments
            metadata.AddArgument(new RuntimeArgument("ConnectionString", typeof(string), ArgumentDirection.In, true));

            // variables
            metadata.AddImplementationVariable(this.noPersistHandle);
            foreach (Variable variable in this.variables)
            {
                metadata.AddVariable(variable);
            }

            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);
        }
        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));
        }
Example #42
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            // The Body introduces another layer of scope. Method metadata.AddImplementationChild
            // (instead of metadata.AddChild) enable access to LoopVariable from the inner
            // block scope of Body.
            if (this.Body != null && this.Body.Handler != null)
            {
                this.invokeBody.Action = this.Body;
                metadata.AddImplementationChild(this.invokeBody);
            }

            // Need to bind the arguments to the custom activity variables explicitly
            // and then add them to the metadata.
            RuntimeArgument startArg = new RuntimeArgument("Start", typeof(int), ArgumentDirection.In, true);
            metadata.Bind(this.Start, startArg);
            metadata.AddArgument(startArg);
            RuntimeArgument stopArg = new RuntimeArgument("Stop", typeof(int), ArgumentDirection.In, true);
            metadata.Bind(this.Stop, stopArg);
            metadata.AddArgument(stopArg);
            RuntimeArgument stepArg = new RuntimeArgument("Step", typeof(int), ArgumentDirection.In, true);
            metadata.Bind(this.Step, stepArg);
            metadata.AddArgument(stepArg);

            // Register variables used in the custom activity.
            metadata.AddImplementationVariable(this.loopVariable);
        }
 /// <summary>
 /// The cache metadata.
 /// </summary>
 /// <param name="metadata">
 /// The metadata.
 /// </param>
 protected override void CacheMetadata(NativeActivityMetadata metadata)
 {
     metadata.AddArgument(new RuntimeArgument("UntilDate", typeof(DateTime), ArgumentDirection.In, true));
     metadata.AddImplementationChild(this.delay);
     metadata.AddImplementationVariable(this.delayInterval);
 }
        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);
        }
        /// <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)
        {
            // Add a validation error if the Operation is not defined.
            if (this.Operation == null)
            {
                metadata.AddValidationError("AzureAsyncOperation requires an Azure activity to execute.");
                return;
            }

            // Add the publicly defined activities as children.
            metadata.AddChild(this.Operation);
            metadata.AddChild(this.Success);
            metadata.AddChild(this.Failure);

            // Define internal variables.
            metadata.AddImplementationVariable(this.PollingEndTime);
            metadata.AddImplementationVariable(this.OperationId);
            metadata.AddImplementationVariable(this.AzureActivityExceptionCaught);

            // Define public arguments.
            var thumbArgument = new RuntimeArgument("CertificateThumbprintId", typeof(string), ArgumentDirection.In);
            metadata.Bind(this.CertificateThumbprintId, thumbArgument);
            metadata.AddArgument(thumbArgument);
            var subArgument = new RuntimeArgument("SubscriptionId", typeof(string), ArgumentDirection.In);
            metadata.Bind(this.SubscriptionId, subArgument);
            metadata.AddArgument(subArgument);

            // Add our activities as delegates.
            metadata.AddDelegate(this.PollingBody);
            metadata.AddDelegate(this.DelayBody);
        }
Example #46
0
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            if (this.Result != null)
            {
                RuntimeArgument resultArgument = new RuntimeArgument(Constants.Result, this.Result.ArgumentType, ArgumentDirection.In);
                metadata.Bind(this.Result, resultArgument);
                metadata.AddArgument(resultArgument);
            }

            if (this.parameters != null)
            {
                int count = 0;
                foreach (InArgument parameter in this.parameters)
                {
                    RuntimeArgument parameterArgument = new RuntimeArgument(Constants.Parameter + count++, parameter.ArgumentType, ArgumentDirection.In);
                    metadata.Bind(parameter, parameterArgument);
                    metadata.AddArgument(parameterArgument);
                }
            }

            RuntimeArgument messageArgument = new RuntimeArgument(Constants.Message, Constants.MessageType, ArgumentDirection.Out, true);
            if (this.Message == null)
            {
                this.Message = new OutArgument<Message>();
            }
            metadata.Bind(this.Message, messageArgument);
            metadata.AddArgument(messageArgument);

            RuntimeArgument correlatesWithArgument = new RuntimeArgument(Constants.CorrelatesWith, Constants.CorrelationHandleType, ArgumentDirection.In);
            if (this.CorrelatesWith == null)
            {
                this.CorrelatesWith = new InArgument<CorrelationHandle>();
            }
            metadata.Bind(this.CorrelatesWith, correlatesWithArgument);
            metadata.AddArgument(correlatesWithArgument);

        }
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            metadata.SetImplementationVariablesCollection(
                new Collection<Variable>
                {
                    this.currentCompensationToken,
                });

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

            if (this.CompensationHandler != null)
            {
                children.Add(CompensationHandler);
            }

            if (this.ConfirmationHandler != null)
            {
                children.Add(ConfirmationHandler);
            }

            if (this.CancellationHandler != null)
            {
                children.Add(CancellationHandler);
            }

            metadata.SetChildrenCollection(children);

            Collection<Activity> implementationChildren = new Collection<Activity>();
            Fx.Assert(DefaultCompensation != null, "DefaultCompensation must be valid");
            implementationChildren.Add(DefaultCompensation);

            Fx.Assert(DefaultConfirmation != null, "DefaultConfirmation must be valid");
            implementationChildren.Add(DefaultConfirmation);

            metadata.SetImplementationChildrenCollection(implementationChildren);

            RuntimeArgument compensationIdArgument = new RuntimeArgument("CompensationId", typeof(long), ArgumentDirection.In);
            metadata.Bind(this.compensationId, compensationIdArgument);
            metadata.AddArgument(compensationIdArgument);
        }
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument correlatesWithArgument = new RuntimeArgument(Constants.CorrelatesWith, Constants.CorrelationHandleType, ArgumentDirection.In);
            if (this.CorrelatesWith == null)
            {
                this.CorrelatesWith = new InArgument<CorrelationHandle>();
            }
            metadata.Bind(this.CorrelatesWith, correlatesWithArgument);
            metadata.AddArgument(correlatesWithArgument);

            if (this.correlationInitializers != null)
            {
                int count = 0;
                foreach (CorrelationInitializer correlation in this.correlationInitializers)
                {
                    if (correlation.CorrelationHandle != null)
                    {
                        RuntimeArgument argument = new RuntimeArgument(Constants.Parameter + count,
                            correlation.CorrelationHandle.ArgumentType, correlation.CorrelationHandle.Direction, true);
                        metadata.Bind(correlation.CorrelationHandle, argument);
                        metadata.AddArgument(argument);
                        count++;
                    }
                }
            }

            RuntimeArgument receiveMessageArgument = new RuntimeArgument(Constants.Message, Constants.MessageType, ArgumentDirection.Out);
            if (this.Message == null)
            {
                this.Message = new OutArgument<Message>();
            }
            metadata.Bind(this.Message, receiveMessageArgument);
            metadata.AddArgument(receiveMessageArgument);

            RuntimeArgument noPersistHandleArgument = new RuntimeArgument(Constants.NoPersistHandle, Constants.NoPersistHandleType, ArgumentDirection.In);
            if (this.NoPersistHandle == null)
            {
                this.NoPersistHandle = new InArgument<NoPersistHandle>();
            }
            metadata.Bind(this.NoPersistHandle, noPersistHandleArgument);
            metadata.AddArgument(noPersistHandleArgument);

            metadata.AddImplementationVariable(this.receiveMessageInstance);
            metadata.AddImplementationVariable(this.extensionReceiveBookmark);

            metadata.AddImplementationChild(this.waitForReply);
        }