protected override void CacheMetadata(CodeActivityMetadata metadata) { Collection<RuntimeArgument> arguments = new Collection<RuntimeArgument>(); Type objectType = TypeHelper.ObjectType; if (this.Value != null) { objectType = this.Value.ArgumentType; } RuntimeArgument argument = new RuntimeArgument("Value", objectType, ArgumentDirection.In, true); metadata.Bind(this.Value, argument); Type argumentType = TypeHelper.ObjectType; if (this.To != null) { argumentType = this.To.ArgumentType; } RuntimeArgument argument2 = new RuntimeArgument("To", argumentType, ArgumentDirection.Out, true); metadata.Bind(this.To, argument2); arguments.Add(argument); arguments.Add(argument2); metadata.SetArgumentsCollection(arguments); if (((this.Value != null) && (this.To != null)) && !TypeHelper.AreTypesCompatible(this.Value.ArgumentType, this.To.ArgumentType)) { metadata.AddValidationError(System.Activities.SR.TypeMismatchForAssign(this.Value.ArgumentType, this.To.ArgumentType, base.DisplayName)); } }
protected override void CacheMetadata(NativeActivityMetadata metadata) { RuntimeArgument subInstanceArgument = new RuntimeArgument("Scope", typeof(BookmarkScope), ArgumentDirection.In); metadata.Bind(this.Scope, subInstanceArgument); metadata.SetArgumentsCollection(new Collection<RuntimeArgument> { subInstanceArgument }); }
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); }
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); }
internal override void CacheMetadata(ActivityMetadata metadata, Activity owner, string operationName) { this.ShredParameters(); int index = 0; foreach (Type type in this.argumentTypes) { if ((type == null) || (type == TypeHelper.VoidType)) { metadata.AddValidationError(System.ServiceModel.Activities.SR.ArgumentCannotHaveNullOrVoidType(owner.DisplayName, this.argumentNames[index])); } if ((type == MessageDescription.TypeOfUntypedMessage) || MessageBuilder.IsMessageContract(type)) { metadata.AddValidationError(System.ServiceModel.Activities.SR.ReceiveParametersContentDoesNotSupportMessage(owner.DisplayName, this.argumentNames[index])); } index++; } if (!metadata.HasViolations) { foreach (KeyValuePair<string, OutArgument> pair in this.Parameters) { RuntimeArgument argument = new RuntimeArgument(pair.Key, pair.Value.ArgumentType, ArgumentDirection.Out); metadata.Bind(pair.Value, argument); metadata.AddArgument(argument); } } }
protected override void CacheMetadata(CodeActivityMetadata metadata) { Collection<RuntimeArgument> arguments = new Collection<RuntimeArgument>(); Type objectType = TypeHelper.ObjectType; if (this.TargetObject != null) { objectType = this.TargetObject.ArgumentType; } RuntimeArgument argument = new RuntimeArgument("TargetObject", objectType, ArgumentDirection.In); metadata.Bind(this.TargetObject, argument); arguments.Add(argument); Type argumentType = TypeHelper.ObjectType; if (this.Result != null) { argumentType = this.Result.ArgumentType; } this.resultArgument = new RuntimeArgument("Result", argumentType, ArgumentDirection.Out); metadata.Bind(this.Result, this.resultArgument); arguments.Add(this.resultArgument); this.methodResolver = this.CreateMethodResolver(); this.methodResolver.DetermineMethodInfo(metadata, out this.methodExecutor); this.methodResolver.RegisterParameters(arguments); metadata.SetArgumentsCollection(arguments); this.methodResolver.Trace(); if (this.methodExecutor != null) { this.methodExecutor.Trace(this); } }
protected override void CacheMetadata(NativeActivityMetadata metadata) { RuntimeArgument targetArgument = new RuntimeArgument("Target", typeof(CompensationToken), ArgumentDirection.In); metadata.Bind(this.Target, targetArgument); metadata.SetArgumentsCollection( new Collection<RuntimeArgument> { targetArgument }); metadata.SetImplementationVariablesCollection( new Collection<Variable> { this.currentCompensationToken }); Fx.Assert(DefaultConfirmation != null, "DefaultConfirmation must be valid"); Fx.Assert(InternalConfirm != null, "InternalConfirm must be valid"); metadata.SetImplementationChildrenCollection( new Collection<Activity> { DefaultConfirmation, InternalConfirm }); }
protected override void CacheMetadata(NativeActivityMetadata metadata) { RuntimeArgument valuesArgument = new RuntimeArgument("Values", typeof(IEnumerable), ArgumentDirection.In, true); metadata.Bind(this.Values, valuesArgument); metadata.SetArgumentsCollection(new Collection<RuntimeArgument> { valuesArgument }); // declare the CompletionCondition as a child if (this.CompletionCondition != null) { metadata.SetChildrenCollection(new Collection<Activity> { this.CompletionCondition }); } // declare the hasCompleted variable if (this.CompletionCondition != null) { if (this.hasCompleted == null) { this.hasCompleted = new Variable<bool>(); } metadata.AddImplementationVariable(this.hasCompleted); } metadata.AddDelegate(this.Body); }
protected override void CacheMetadata(ActivityMetadata metadata) { if (string.IsNullOrEmpty(this.OperationName)) { metadata.AddValidationError(System.ServiceModel.Activities.SR.MissingOperationName(base.DisplayName)); } MessagingActivityHelper.ValidateCorrelationInitializer(metadata, this.correlationInitializers, false, base.DisplayName, this.OperationName); MessagingActivityHelper.AddRuntimeArgument(this.CorrelatesWith, "CorrelatesWith", Constants.CorrelationHandleType, ArgumentDirection.In, metadata); this.InternalContent.CacheMetadata(metadata, this, this.OperationName); if (this.correlationInitializers != null) { for (int i = 0; i < this.correlationInitializers.Count; i++) { CorrelationInitializer initializer = this.correlationInitializers[i]; initializer.ArgumentName = "Parameter" + i; RuntimeArgument argument = new RuntimeArgument(initializer.ArgumentName, Constants.CorrelationHandleType, ArgumentDirection.In); metadata.Bind(initializer.CorrelationHandle, argument); metadata.AddArgument(argument); } } if (!metadata.HasViolations) { this.internalReceive = this.CreateInternalReceive(); this.InternalContent.ConfigureInternalReceive(this.internalReceive, out this.requestFormatter); } else { this.internalReceive = null; this.requestFormatter = null; } }
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); }
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); }
/// <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) { RuntimeArgument argument = new RuntimeArgument("Target", typeof(CompensationToken), ArgumentDirection.In); metadata.Bind(this.Target, argument); metadata.SetArgumentsCollection(new Collection<RuntimeArgument> { argument }); metadata.SetImplementationVariablesCollection(new Collection<Variable> { this.toConfirmToken }); metadata.SetImplementationChildrenCollection(new Collection<Activity> { this.Body }); }
protected override void CacheMetadata(CodeActivityMetadata metadata) { RuntimeArgument argument = new RuntimeArgument("Text", typeof(string), ArgumentDirection.In); metadata.Bind(this.Text, argument); RuntimeArgument argument2 = new RuntimeArgument("TextWriter", typeof(System.IO.TextWriter), ArgumentDirection.In); metadata.Bind(this.TextWriter, argument2); metadata.SetArgumentsCollection(new Collection<RuntimeArgument> { argument, argument2 }); }
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); }
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); }
public MethodExecutor(Activity invokingActivity, Type targetType, InArgument targetObject, Collection<Argument> parameters, RuntimeArgument returnObject) { this.invokingActivity = invokingActivity; this.targetType = targetType; this.targetObject = targetObject; this.parameters = parameters; this.returnObject = returnObject; }
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); }
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); }
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); }
protected override void CacheMetadata(CodeActivityMetadata metadata) { RuntimeArgument argument = new RuntimeArgument("Collection", typeof(ICollection <T>), ArgumentDirection.In, true); metadata.Bind(this.Collection, argument); metadata.SetArgumentsCollection(new Collection <RuntimeArgument> { argument }); }
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); }
protected override void CacheMetadata(CodeActivityMetadata metadata) { RuntimeArgument exceptionArgument = new RuntimeArgument("Exception", typeof(Exception), ArgumentDirection.In, true); metadata.Bind(this.Exception, exceptionArgument); metadata.SetArgumentsCollection(new Collection <RuntimeArgument> { exceptionArgument }); }
protected override void CacheMetadata(NativeActivityMetadata metadata) { RuntimeArgument argument = new RuntimeArgument("Scope", typeof(BookmarkScope), ArgumentDirection.In); metadata.Bind(this.Scope, argument); metadata.SetArgumentsCollection(new Collection <RuntimeArgument> { argument }); }
public void GetValueRuntimeArgumentRValue() { Variable <int> var = new Variable <int>(); RuntimeArgument ra = new RuntimeArgument("InArgument", typeof(int), ArgumentDirection.In); Expression <Func <ActivityContext, object> > expression = (env) => env.GetValue(ra); ArgumentValue <object> expectedActivity = new ArgumentValue <object>("InArgument"); ConvertAndValidate(expression, expectedActivity, null); }
public static void OnGetArguments <TOperand>(CodeActivityMetadata metadata, InArgument <TOperand> operand) { RuntimeArgument argument = new RuntimeArgument("Operand", typeof(TOperand), ArgumentDirection.In, true); metadata.Bind(operand, argument); metadata.SetArgumentsCollection(new Collection <RuntimeArgument> { argument }); }
protected override void CacheMetadata(CodeActivityMetadata metadata) { metadata.RequireExtension <IEventBroker>(); var button = new RuntimeArgument("Button", typeof(ManagerButtonsEnum), ArgumentDirection.In); metadata.AddArgument(button); metadata.Bind(this.Button, button); }
public AsyncPatternMethodExecutor(AsyncPatternMethodExecutor copy, Type targetType, InArgument targetObject, Collection <Argument> parameters, RuntimeArgument returnObject) : base(copy.invokingActivity, targetType, targetObject, parameters, returnObject) { this.beginMethod = copy.beginMethod; this.endMethod = copy.endMethod; this.beginFunc = copy.beginFunc; this.endFunc = copy.endFunc; }
protected override void CacheMetadata(NativeActivityMetadata metadata) { RuntimeArgument targetArgument = new RuntimeArgument("Target", typeof(CompensationToken), ArgumentDirection.In); metadata.Bind(this.Target, targetArgument); metadata.SetArgumentsCollection(new Collection <RuntimeArgument> { targetArgument }); }
protected virtual void VisitVariableScopeArgument(RuntimeArgument runtimeArgument, out bool exit) { VisitArgument(runtimeArgument, out exit); if (exit) { return; } exit = false; }
protected override void CacheMetadata(NativeActivityMetadata metadata) { metadata.AddDelegate(this.Action); RuntimeArgument argument = new RuntimeArgument("Argument", typeof(T), ArgumentDirection.In, true); metadata.Bind(this.Argument, argument); metadata.SetArgumentsCollection(new Collection <RuntimeArgument> { argument }); }
protected override void CacheMetadata(CodeActivityMetadata metadata) { for (int i = 0; i < this.Elements.Count; i++) { RuntimeArgument argArgument = new RuntimeArgument( "Element_" + i, this.Elements[i].ArgumentType, ArgumentDirection.In); //NOXLATE metadata.Bind(this.Elements[i], argArgument); metadata.AddArgument(argArgument); } }
protected override void CacheMetadata(CodeActivityMetadata metadata) { RuntimeArgument runtimeArgument1 = new RuntimeArgument("Print", typeof(object), ArgumentDirection.In); metadata.Bind((Argument)this.Print, runtimeArgument1); metadata.SetArgumentsCollection(new Collection <RuntimeArgument>() { runtimeArgument1, }); }
protected override void CacheMetadata(CodeActivityMetadata metadata) { RuntimeArgument runtimeArgument1 = new RuntimeArgument("Число", typeof(Int32), ArgumentDirection.InOut); metadata.Bind((Argument)this.Число, runtimeArgument1); metadata.SetArgumentsCollection(new Collection <RuntimeArgument>() { runtimeArgument1, }); }
protected override void CacheMetadata(ActivityMetadata metadata) { IPSHelper.CacheMetadataHelper(metadata, this.Input, this.Errors, this.CommandText, GetType().Name, this.DisplayName, this.PowerShellVariables, this.Parameters, this.childPowerShellVariables, this.childParameters); RuntimeArgument outputArgument = new RuntimeArgument("Output", typeof(Collection <PSObject>), ArgumentDirection.Out, false); metadata.Bind(this.Output, outputArgument); metadata.AddArgument(outputArgument); }
protected override void CacheMetadata(CodeActivityMetadata metadata) { RuntimeArgument textArgument = new RuntimeArgument("Test", typeof(string), ArgumentDirection.In); metadata.Bind(this.Test, textArgument); metadata.SetArgumentsCollection( new Collection<RuntimeArgument> { textArgument, }); }
protected override void CacheMetadata(CodeActivityMetadata metadata) { RuntimeArgument runtimeArgument = new RuntimeArgument("ValidationContext", typeof(ValidationContext), ArgumentDirection.In, true); metadata.Bind(this.ValidationContext, runtimeArgument); metadata.SetArgumentsCollection(new Collection <RuntimeArgument> { runtimeArgument }); }
public static void CacheMetadataHelper( ActivityMetadata metadata, InArgument <IEnumerable> input, OutArgument <Collection <ErrorRecord> > errors, string commandText, string typeName, string displayName, IDictionary <string, Argument> variables, IDictionary <string, InArgument> parameters, IDictionary <string, Argument> childVariables, IDictionary <string, InArgument> childParameters) { childVariables.Clear(); childParameters.Clear(); RuntimeArgument inputArgument = new RuntimeArgument("Input", typeof(IEnumerable), ArgumentDirection.In); metadata.Bind(input, inputArgument); metadata.AddArgument(inputArgument); RuntimeArgument errorArgument = new RuntimeArgument("Errors", typeof(Collection <ErrorRecord>), ArgumentDirection.Out); metadata.Bind(errors, errorArgument); metadata.AddArgument(errorArgument); if (commandText == null || string.IsNullOrEmpty(commandText.Trim())) { metadata.AddValidationError(string.Format(ErrorMessages.PowerShellRequiresCommand, displayName)); } foreach (KeyValuePair <string, Argument> variable in variables) { string name = variable.Key; Argument argument = variable.Value; RuntimeArgument ra = new RuntimeArgument(name, argument.ArgumentType, argument.Direction, true); metadata.Bind(argument, ra); metadata.AddArgument(ra); Argument childArgument = Argument.Create(argument.ArgumentType, argument.Direction); childVariables.Add(name, Argument.CreateReference(argument, name)); } foreach (KeyValuePair <string, InArgument> parameter in parameters) { string name = parameter.Key; InArgument argument = parameter.Value; RuntimeArgument ra; if (argument.ArgumentType == typeof(bool)) { ra = new RuntimeArgument(name, argument.ArgumentType, argument.Direction, false); } else { ra = new RuntimeArgument(name, argument.ArgumentType, argument.Direction, true); } metadata.Bind(argument, ra); metadata.AddArgument(ra); Argument childArgument = Argument.Create(argument.ArgumentType, argument.Direction); childParameters.Add(name, Argument.CreateReference(argument, name) as InArgument); } }
/// <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 ... }
private void ValidateExpressionSubtree(ActivityUtilities.ChildActivity childActivity, ActivityUtilities.ActivityCallStack parentChain) { if (childActivity.Activity.InternalCanInduceIdle) { Activity activity = childActivity.Activity; Activity expressionRoot = this.expressionRoot; RuntimeArgument boundRuntimeArgument = ActivityValidationServices.GetBoundRuntimeArgument(expressionRoot); ValidationError data = new ValidationError(System.Activities.SR.CanInduceIdleActivityInArgumentExpression(boundRuntimeArgument.Name, expressionRoot.Parent.DisplayName, activity.DisplayName), true, boundRuntimeArgument.Name, expressionRoot.Parent); ActivityUtilities.Add <ValidationError>(ref this.errors, data); } }
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); }
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); }
protected override void CacheMetadata(NativeActivityMetadata metadata) { metadata.AddImplementationChild(_w1); RuntimeArgument exceptionArgument = new RuntimeArgument("OutcomeOnCancellation", typeof(OutcomeState), ArgumentDirection.In, true); metadata.Bind(this.OutcomeOnCancellation, exceptionArgument); metadata.SetArgumentsCollection(new Collection <RuntimeArgument> { exceptionArgument }); //base.CacheMetadata(metadata); }
public AsyncWaitCallbackMethodExecutor(CodeActivityMetadata metadata, MethodInfo asyncMethod, Activity invokingActivity, Type targetType, InArgument targetObject, Collection <Argument> parameters, RuntimeArgument returnObject, MruCache <MethodInfo, Func <object, object[], object> > funcCache, ReaderWriterLockSlim locker) : base(invokingActivity, targetType, targetObject, parameters, returnObject) { Fx.Assert(asyncMethod != null, "Must provide asyncMethod"); this.asyncMethod = asyncMethod; this.asyncFunc = MethodCallExpressionHelper.GetFunc(metadata, asyncMethod, funcCache, locker); }
/// <summary> /// 创建并验证活动的参数、变量、子活动和活动委托的说明。 /// </summary> /// <param name="metadata"></param> protected override void CacheMetadata(CodeActivityMetadata metadata) { foreach (KeyValuePair <string, Argument> argument2 in Arguments) { Argument value = argument2.Value; RuntimeArgument argument = new RuntimeArgument(argument2.Key, value.ArgumentType, value.Direction); metadata.Bind(value, argument); metadata.AddArgument(argument); } base.CacheMetadata(metadata); }
//创建并验证活动的参数、变量、子活动和活动委托的说明 protected override void CacheMetadata(CodeActivityMetadata metadata) { base.CacheMetadata(metadata); int num = 0; foreach (InArgument para in Parameters) { RuntimeArgument argument = new RuntimeArgument("attachmentArg" + ++num, para.ArgumentType, ArgumentDirection.In); metadata.Bind(para, argument); metadata.AddArgument(argument); } }
protected override void CacheMetadata(NativeActivityMetadata metadata) { Collection <RuntimeArgument> arguments = new Collection <RuntimeArgument>(); foreach (KeyValuePair <string, Argument> pair in this.DelegateArguments) { RuntimeArgument argument = new RuntimeArgument(pair.Key, pair.Value.ArgumentType, pair.Value.Direction); metadata.Bind(pair.Value, argument); arguments.Add(argument); } metadata.SetArgumentsCollection(arguments); metadata.AddDelegate(this.Delegate); if (this.Delegate != null) { IList <RuntimeDelegateArgument> runtimeDelegateArguments = this.Delegate.RuntimeDelegateArguments; if (this.DelegateArguments.Count != runtimeDelegateArguments.Count) { metadata.AddValidationError(System.Activities.SR.WrongNumberOfArgumentsForActivityDelegate); } for (int i = 0; i < runtimeDelegateArguments.Count; i++) { RuntimeDelegateArgument argument2 = runtimeDelegateArguments[i]; Argument argument3 = null; string name = argument2.Name; if (this.DelegateArguments.TryGetValue(name, out argument3)) { if (argument3.Direction != argument2.Direction) { metadata.AddValidationError(System.Activities.SR.DelegateParameterDirectionalityMismatch(name, argument3.Direction, argument2.Direction)); } if (argument2.Direction == ArgumentDirection.In) { if (!TypeHelper.AreTypesCompatible(argument3.ArgumentType, argument2.Type)) { metadata.AddValidationError(System.Activities.SR.DelegateInArgumentTypeMismatch(name, argument2.Type, argument3.ArgumentType)); } } else if (!TypeHelper.AreTypesCompatible(argument2.Type, argument3.ArgumentType)) { metadata.AddValidationError(System.Activities.SR.DelegateOutArgumentTypeMismatch(name, argument2.Type, argument3.ArgumentType)); } } else { metadata.AddValidationError(System.Activities.SR.InputParametersMissing(argument2.Name)); } if (!this.hasOutputArguments && ArgumentDirectionHelper.IsOut(argument2.Direction)) { this.hasOutputArguments = true; } } } }
/// <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); }
protected override void CacheMetadata(NativeActivityMetadata metadata) { Collection<RuntimeArgument> arguments = new Collection<RuntimeArgument>(); foreach (KeyValuePair<string, Argument> pair in this.DelegateArguments) { RuntimeArgument argument = new RuntimeArgument(pair.Key, pair.Value.ArgumentType, pair.Value.Direction); metadata.Bind(pair.Value, argument); arguments.Add(argument); } metadata.SetArgumentsCollection(arguments); metadata.AddDelegate(this.Delegate); if (this.Delegate != null) { IList<RuntimeDelegateArgument> runtimeDelegateArguments = this.Delegate.RuntimeDelegateArguments; if (this.DelegateArguments.Count != runtimeDelegateArguments.Count) { metadata.AddValidationError(System.Activities.SR.WrongNumberOfArgumentsForActivityDelegate); } for (int i = 0; i < runtimeDelegateArguments.Count; i++) { RuntimeDelegateArgument argument2 = runtimeDelegateArguments[i]; Argument argument3 = null; string name = argument2.Name; if (this.DelegateArguments.TryGetValue(name, out argument3)) { if (argument3.Direction != argument2.Direction) { metadata.AddValidationError(System.Activities.SR.DelegateParameterDirectionalityMismatch(name, argument3.Direction, argument2.Direction)); } if (argument2.Direction == ArgumentDirection.In) { if (!TypeHelper.AreTypesCompatible(argument3.ArgumentType, argument2.Type)) { metadata.AddValidationError(System.Activities.SR.DelegateInArgumentTypeMismatch(name, argument2.Type, argument3.ArgumentType)); } } else if (!TypeHelper.AreTypesCompatible(argument2.Type, argument3.ArgumentType)) { metadata.AddValidationError(System.Activities.SR.DelegateOutArgumentTypeMismatch(name, argument2.Type, argument3.ArgumentType)); } } else { metadata.AddValidationError(System.Activities.SR.InputParametersMissing(argument2.Name)); } if (!this.hasOutputArguments && ArgumentDirectionHelper.IsOut(argument2.Direction)) { this.hasOutputArguments = true; } } } }
protected override void CacheMetadata(NativeActivityMetadata metadata) { metadata.AddChild(this.Body); metadata.SetImplementationVariablesCollection( new Collection<Variable> { this.declaredHandle }); RuntimeArgument correlatesWithArgument = new RuntimeArgument("CorrelatesWith", typeof(CorrelationHandle), ArgumentDirection.In); metadata.Bind(this.CorrelatesWith, correlatesWithArgument); metadata.SetArgumentsCollection(new Collection<RuntimeArgument> { correlatesWithArgument }); }
protected override void CacheMetadata(NativeActivityMetadata metadata) { Collection<RuntimeArgument> arguments = new Collection<RuntimeArgument>(); RuntimeArgument argument = new RuntimeArgument("Message", typeof(string), ArgumentDirection.In); metadata.Bind(this.Message, argument); arguments.Add(argument); RuntimeArgument argument2 = new RuntimeArgument("IsWarning", typeof(bool), ArgumentDirection.In, false); metadata.Bind(this.IsWarning, argument2); arguments.Add(argument2); RuntimeArgument argument3 = new RuntimeArgument("PropertyName", typeof(string), ArgumentDirection.In, false); metadata.Bind(this.PropertyName, argument3); arguments.Add(argument3); metadata.SetArgumentsCollection(arguments); }
public MethodExecutor(Activity invokingActivity, Type targetType, InArgument targetObject, Collection<Argument> parameters, RuntimeArgument returnObject) { Fx.Assert(invokingActivity != null, "Must provide invokingActivity"); Fx.Assert(targetType != null || (targetObject != null), "Must provide targetType or targetObject"); Fx.Assert(parameters != null, "Must provide parameters"); // returnObject is optional this.invokingActivity = invokingActivity; this.targetType = targetType; this.targetObject = targetObject; this.parameters = parameters; this.returnObject = returnObject; }
protected override void CacheMetadata(NativeActivityMetadata metadata) { Collection<RuntimeArgument> arguments = new Collection<RuntimeArgument>(); RuntimeArgument argument = new RuntimeArgument("Reason", typeof(string), ArgumentDirection.In, false); metadata.Bind(this.Reason, argument); RuntimeArgument argument2 = new RuntimeArgument("Exception", typeof(System.Exception), ArgumentDirection.In, false); metadata.Bind(this.Exception, argument2); arguments.Add(argument); arguments.Add(argument2); metadata.SetArgumentsCollection(arguments); if (((this.Reason == null) || this.Reason.IsEmpty) && ((this.Exception == null) || this.Exception.IsEmpty)) { metadata.AddValidationError(System.Activities.SR.OneOfTwoPropertiesMustBeSet("Reason", "Exception", "TerminateWorkflow", base.DisplayName)); } }
protected override void CacheMetadata(CodeActivityMetadata metadata) { if (this.parameters != null) { int num = 0; foreach (InArgument argument in this.parameters) { RuntimeArgument argument2 = new RuntimeArgument("Parameter" + num++, argument.ArgumentType, ArgumentDirection.In); metadata.Bind(argument, argument2); metadata.AddArgument(argument2); } } RuntimeArgument argument3 = new RuntimeArgument("Message", System.ServiceModel.Activities.Constants.MessageType, ArgumentDirection.Out, true); metadata.Bind(this.Message, argument3); metadata.AddArgument(argument3); }
protected override void CacheMetadata(NativeActivityMetadata metadata) { RuntimeArgument argument = new RuntimeArgument("Condition", typeof(bool), ArgumentDirection.In, true); metadata.Bind(this.Condition, argument); metadata.SetArgumentsCollection(new Collection<RuntimeArgument> { argument }); Collection<Activity> collection = null; if (this.Then != null) { ActivityUtilities.Add<Activity>(ref collection, this.Then); } if (this.Else != null) { ActivityUtilities.Add<Activity>(ref collection, this.Else); } metadata.SetChildrenCollection(collection); }
private static bool CheckIfArgumentIsNotBound(RuntimeArgument argument, IDictionary<string, object> inputs) { if (((argument.Owner != null) && (argument.Owner.Parent == null)) && ArgumentDirectionHelper.IsOut(argument.Direction)) { return false; } if ((argument.BoundArgument != null) && (argument.BoundArgument.Expression != null)) { return false; } if ((inputs != null) && inputs.ContainsKey(argument.Name)) { return false; } return true; }
public ArgumentInfo(RuntimeArgument argument) { this.Name = argument.Name; Fx.Assert(argument.Type != null, "argument Type must not be null."); this.Type = argument.Type; this.HasGetTypeBeenAttempted = true; this.FullAssemblyQualifiedTypeName = this.Type.AssemblyQualifiedName; // this versionless assembly-qualified type name causes types of different versions // to be considered equal for the sake of argument matching. // Serializing the argument type info in a string format allows // the map to be loaded into environment in which the types may not be available. this.versionlessAssemblyQualifiedTypeName = GenerateVersionlessAssemblyQualifiedTypeName(argument.Type); this.Direction = argument.Direction; }
protected override void CacheMetadata(CodeActivityMetadata metadata) { 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); metadata.Bind(this.Message, messageArgument); metadata.AddArgument(messageArgument); Fx.Assert(this.Send != null, "Send cannot be null"); }
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); }
protected override void CacheMetadata(CodeActivityMetadata metadata) { Collection<RuntimeArgument> arguments = new Collection<RuntimeArgument>(); Type valueType = TypeHelper.ObjectType; if (this.Value != null) { valueType = this.Value.ArgumentType; } RuntimeArgument valueArgument = new RuntimeArgument("Value", valueType, ArgumentDirection.In, true); metadata.Bind(this.Value, valueArgument); Type toType = TypeHelper.ObjectType; if (this.To != null) { toType = this.To.ArgumentType; } RuntimeArgument toArgument = new RuntimeArgument("To", toType, ArgumentDirection.Out, true); metadata.Bind(this.To, toArgument); arguments.Add(valueArgument); arguments.Add(toArgument); metadata.SetArgumentsCollection(arguments); if (this.Value != null && this.To != null) { if (!TypeHelper.AreTypesCompatible(this.Value.ArgumentType, this.To.ArgumentType)) { metadata.AddValidationError(SR.TypeMismatchForAssign( this.Value.ArgumentType, this.To.ArgumentType, this.DisplayName)); } } }