Beispiel #1
0
    protected DvStateVariable _relatedStateVariable; // References the related state variable in our parent action's parent service

    /// <summary>
    /// Creates a new formal argument for a device's action.
    /// </summary>
    /// <param name="name">Name of the argument. The name SHOULD be chosen to reflect the semantic use
    /// of the argument. MUST NOT contain a hyphen character ("-") nor
    /// a hash character (“#”, 23 Hex in UTF-8). Case sensitive. First character MUST be a USASCII
    /// letter ("A"-"Z", "a"-"z"), USASCII digit ("0"-"9"), an underscore ("_"), or a non-experimental
    /// Unicode letter or digit greater than U+007F. Succeeding characters MUST be a USASCII letter
    /// ("A"-"Z", "a"-"z"), USASCII digit ("0"-"9"), an underscore ("_"), a period ("."), a Unicode
    /// combiningchar, an extender, or a non-experimental Unicode letter or digit greater than
    /// U+007F. The first three letters MUST NOT be "XML" in any combination of case.
    /// Case sensitive. SHOULD be &lt; 32 characters.
    /// </param>
    /// <param name="relatedStateVariable">Defines the type of the argument; see further explanation in (DevArch).</param>
    /// <param name="direction">Defines whether argument is an input or output parameter.</param>
    /// <param name="isReturnValue">Returns the information if this argument is the return value of the parent
    /// action. This argument is allowed to be <c>true</c> at most for one argument per action. If it is set to
    /// <c>true</c> for an argument, that argument MUST be the first output argument of the action.</param>
    public DvArgument(string name, DvStateVariable relatedStateVariable, ArgumentDirection direction, bool isReturnValue)
    {
      _name = name;
      _relatedStateVariable = relatedStateVariable;
      _direction = direction;
      _isReturnValue = isReturnValue;
    }
		public RuntimeDelegateArgument (string name, Type type, ArgumentDirection direction, DelegateArgument boundArgument)
		{
			Name = name;
			Type = type;
			Direction = direction;
			BoundArgument = boundArgument;
		}
        public RuntimeDelegateArgument(string name, Type type, ArgumentDirection direction, DelegateArgument boundArgument)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw FxTrace.Exception.ArgumentNullOrEmpty("name");
            }

            if (type == null)
            {
                throw FxTrace.Exception.ArgumentNull("type");
            }

            ArgumentDirectionHelper.Validate(direction, "direction");

            if (boundArgument != null)
            {
                // Validations that the bound argument matches are done
                // in CacheMetadata for ActivityDelegate.

                boundArgument.Bind(this);
            }

            this.Name = name;
            this.Type = type;
            this.Direction = direction;
            this.BoundArgument = boundArgument;
        }
 public InlinedLocationReference(LocationReference innerReference, Activity validAccessor, ArgumentDirection accessDirection)
 {
     this.innerReference = innerReference;
     this.validAccessor = validAccessor;
     this.allowReads = accessDirection != ArgumentDirection.Out;
     this.allowWrites = accessDirection != ArgumentDirection.In;
 }
 public static void Validate(ArgumentDirection direction, string argumentName)
 {
     if (!IsDefined(direction))
     {
         throw FxTrace.Exception.AsError(new InvalidEnumArgumentException(argumentName, (int) direction, typeof(ArgumentDirection)));
     }
 }
Beispiel #6
0
		internal UPnPArgument(XmlElement Xml)
		{
			this.xml = Xml;

			foreach (XmlNode N in Xml.ChildNodes)
			{
				switch (N.LocalName)
				{
					case "name":
						this.name = N.InnerText;
						break;

					case "direction":
						if (N.InnerText.ToLower() == "out")
							this.direction = ArgumentDirection.Out;
						else
							this.direction = ArgumentDirection.In;
						break;

					case "retval":
						this.returnValue = true;
						break;

					case "relatedStateVariable":
						this.relatedStateVariable = N.InnerText;
						break;
				}
			}
		}
 public static bool IsOut(ArgumentDirection direction)
 {
     if (direction != ArgumentDirection.Out)
     {
         return (direction == ArgumentDirection.InOut);
     }
     return true;
 }
Beispiel #8
0
 public static void Validate(ArgumentDirection direction, string argumentName)
 {
     if (!IsDefined(direction))
     {
         throw FxTrace.Exception.AsError(
                   new InvalidEnumArgumentException(argumentName, (int)direction, typeof(ArgumentDirection)));
     }
 }
Beispiel #9
0
        //internal RuntimeArgument(string name, Type argumentType, ArgumentDirection direction, bool isRequired, List<string> overloadGroups, PropertyDescriptor bindingProperty, object propertyOwner)
        //    : this(name, argumentType, direction, isRequired, overloadGroups)
        //{
        //    this.bindingProperty = bindingProperty;
        //    this.bindingPropertyOwner = propertyOwner;
        //}

        internal RuntimeArgument(string name, Type argumentType, ArgumentDirection direction, bool isRequired, List <string> overloadGroups, Argument argument)
            : this(name, argumentType, direction, isRequired, overloadGroups)
        {
            Fx.Assert(argument != null, "This ctor is only for arguments discovered via reflection in an IDictionary and therefore cannot be null.");

            // Bind straightway since we're not dealing with a property and empty binding isn't an issue.
            Argument.Bind(argument, this);
        }
 internal static bool IsDefined(ArgumentDirection direction)
 {
     if ((direction != ArgumentDirection.In) && (direction != ArgumentDirection.Out))
     {
         return (direction == ArgumentDirection.InOut);
     }
     return true;
 }
        void AddGeneratedArgument(Type argumentType, ArgumentDirection direction, ActivityWithResult expression)
        {
            Argument argument = ActivityUtilities.CreateArgument(argumentType, direction);

            argument.Expression = expression;
            RuntimeArgument runtimeArgument = this.metadata.CurrentActivity.AddTempAutoGeneratedArgument(argumentType, direction);

            Argument.TryBind(argument, runtimeArgument, this.metadata.CurrentActivity);
        }
Beispiel #12
0
    protected CpStateVariable _relatedStateVariable; // References the related state variable in our parent action's parent service

    public CpArgument(CpAction parentAction, string name, CpStateVariable relatedStateVariable, ArgumentDirection direction,
        bool isReturnValue)
    {
      _parentAction = parentAction;
      _name = name;
      _relatedStateVariable = relatedStateVariable;
      _direction = direction;
      _isReturnValue = isReturnValue;
    }
Beispiel #13
0
        protected CpStateVariable _relatedStateVariable; // References the related state variable in our parent action's parent service

        public CpArgument(CpAction parentAction, string name, CpStateVariable relatedStateVariable, ArgumentDirection direction,
                          bool isReturnValue)
        {
            _parentAction         = parentAction;
            _name                 = name;
            _relatedStateVariable = relatedStateVariable;
            _direction            = direction;
            _isReturnValue        = isReturnValue;
        }
Beispiel #14
0
        public Argument(string name, string relatedStateVariable, ArgumentDirection direction, bool isReturnValue)
            : this(name, relatedStateVariable, direction)
        {
            if (isReturnValue && direction == ArgumentDirection.In)
            {
                throw new ArgumentException("The direction is In, but isReturnValue is true. " +
                                            "An IsReturnValue argument must have the direction Out.");
            }

            IsReturnValue = isReturnValue;
        }
Beispiel #15
0
        protected internal Argument(string name, ArgumentDirection direction, bool isReturnValue, StateVariable relatedStateVariable)
        {
            if (name == null) throw new ArgumentNullException ("name");
            if (isReturnValue && direction == ArgumentDirection.In) throw new ArgumentException ("If the argument is a return value, it must have an 'Out' direction.");
            if (relatedStateVariable == null) throw new ArgumentNullException ("relatedStateVariable");

            this.name = name;
            this.direction = direction;
            this.is_return_value = isReturnValue;
            this.related_state_variable = relatedStateVariable;
        }
        public bool TryGetAccessToPublicLocation(LocationReference publicLocation,
            ArgumentDirection accessDirection, out LocationReference equivalentLocation)
        {
            if (publicLocation == null)
            {
                throw FxTrace.Exception.ArgumentNull("publicLocation");
            }
            ThrowIfUninitialized();

            return TryGetAccessToPublicLocation(publicLocation, accessDirection, false, out equivalentLocation);
        }
        public bool TryGetAccessToPublicLocation(LocationReference publicLocation,
                                                 ArgumentDirection accessDirection, out LocationReference equivalentLocation)
        {
            if (publicLocation == null)
            {
                throw FxTrace.Exception.ArgumentNull("publicLocation");
            }
            ThrowIfUninitialized();

            return(TryGetAccessToPublicLocation(publicLocation, accessDirection, false, out equivalentLocation));
        }
Beispiel #18
0
        public Argument(string name, string relatedStateVariable, ArgumentDirection direction)
        {
            if (direction < ArgumentDirection.In || direction > ArgumentDirection.Out)
            {
                throw new ArgumentOutOfRangeException("direction");
            }

            Name = name;
            RelatedStateVariable = relatedStateVariable;
            Direction            = direction;
        }
 private static Type CreateArgumentType(Type type, ArgumentDirection direction)
 {
     if (direction == ArgumentDirection.In)
     {
         return(ActivityUtilities.inArgumentGenericType.MakeGenericType(new Type[] { type }));
     }
     if (direction == ArgumentDirection.Out)
     {
         return(ActivityUtilities.outArgumentGenericType.MakeGenericType(new Type[] { type }));
     }
     return(ActivityUtilities.inOutArgumentGenericType.MakeGenericType(new Type[] { type }));
 }
 public static Argument CreateArgumentOfObject(ArgumentDirection direction)
 {
     if (direction == ArgumentDirection.In)
     {
         return((Argument)Activator.CreateInstance(inArgumentOfObjectType));
     }
     if (direction == ArgumentDirection.Out)
     {
         return((Argument)Activator.CreateInstance(outArgumentOfObjectType));
     }
     return((Argument)Activator.CreateInstance(inOutArgumentOfObjectType));
 }
        private static void AddRuntimeArgument(this
                                               CodeActivityMetadata metadata,
                                               Argument argument,
                                               Type argumentType,
                                               ArgumentDirection direction,
                                               string argumentName,
                                               bool isRequired)
        {
            var arg = new RuntimeArgument(argumentName, argumentType, direction, isRequired);

            metadata.Bind(argument, arg);
            metadata.AddArgument(arg);
        }
        /// <summary>
        /// Counts the number of arguments with a specified direction.
        /// </summary>
        /// <param name="dir">The direction of the arguments.</param>
        /// <returns>The number of arguments matching the direction.</returns>
        protected int ArgDirCount(ArgumentDirection dir)
        {
            int liCount = 0;

            foreach (ArgumentDescription ladDesc in this.Values)
            {
                if (ladDesc.DirectionValue == dir)
                {
                    liCount++;
                }
            }

            return(liCount);
        }
        public static void AddRuntimeArgument(
            this NativeActivityMetadata metadata,
            Argument messageArgument,
            string runtimeArgumentName,
            Type runtimeArgumentType,
            ArgumentDirection runtimeArgumentDirection,
            bool isRequired,
            List <string> overloadGroupNames)
        {
            RuntimeArgument runtimeArgument = new RuntimeArgument(runtimeArgumentName, runtimeArgumentType, runtimeArgumentDirection, isRequired, overloadGroupNames);

            metadata.Bind(messageArgument, runtimeArgument);
            metadata.AddArgument(runtimeArgument);
        }
Beispiel #24
0
        private static ParameterDirection WokflowDbParameterToParameterDirection(ArgumentDirection argumentDirection)
        {
            switch (argumentDirection)
            {
            case ArgumentDirection.In:
                return(ParameterDirection.Input);

            case ArgumentDirection.Out:
                return(ParameterDirection.Output);

            default:
                return(ParameterDirection.InputOutput);
            }
        }
Beispiel #25
0
        public RuntimeArgument(string name, Type argumentType, ArgumentDirection direction, bool isRequired, List <string> overloadGroupNames)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw FxTrace.Exception.ArgumentNullOrEmpty(nameof(name));
            }

            ArgumentDirectionHelper.Validate(direction, "direction");

            this.name               = name;
            this.type               = argumentType ?? throw FxTrace.Exception.ArgumentNull(nameof(argumentType));
            this.Direction          = direction;
            this.IsRequired         = isRequired;
            this.overloadGroupNames = overloadGroupNames;
        }
Beispiel #26
0
        public static Argument CreateFromAttributes(string name, string type)
        {
            Argument arg = new Argument(name);

            int parenthesisIndex = type.IndexOf('(');

            string            dirType      = type.Substring(0, parenthesisIndex);
            ArgumentDirection argDirection = ArgumentDirectionMethods.Parse(dirType);

            arg.Direction = argDirection;

            arg.Type = type.Substring(parenthesisIndex + 1, type.Length - parenthesisIndex - 2);

            return(arg);
        }
        public static string Prefix(this ArgumentDirection type)
        {
            switch (type)
            {
            case ArgumentDirection.In:
                return("in_");

            case ArgumentDirection.InOut:
                return("io_");

            case ArgumentDirection.Out:
                return("out_");
            }
            return(string.Empty);
        }
        public static Argument CreateReferenceArgument(Type argumentType, ArgumentDirection direction, string referencedArgumentName)
        {
            Argument argument = Argument.Create(argumentType, direction);
            object   obj2     = null;

            if (direction == ArgumentDirection.In)
            {
                obj2 = Activator.CreateInstance(argumentValueGenericType.MakeGenericType(new Type[] { argumentType }), new object[] { referencedArgumentName });
            }
            else
            {
                obj2 = Activator.CreateInstance(argumentReferenceGenericType.MakeGenericType(new Type[] { argumentType }), new object[] { referencedArgumentName });
            }
            argument.Expression = (ActivityWithResult)obj2;
            return(argument);
        }
        // In 4.0 the expression type for publicly inspectable auto-generated arguments was
        // LocationReferenceValue<T>, whether the argument was actually used as an L-Value or R-Value.
        // We keep that for back-compat (useLocationReferenceValue == true), and only use the new
        // EnvironmentLocationValue/Reference classes for new activities.
        internal bool TryGetAccessToPublicLocation(LocationReference publicLocation,
                                                   ArgumentDirection accessDirection, bool useLocationReferenceValue, out LocationReference equivalentLocation)
        {
            Fx.Assert(!useLocationReferenceValue || this.ActivityMetadata.CurrentActivity.UseOldFastPath, "useLocationReferenceValue should only be used for back-compat");

            if (this.metadata.Environment.IsVisible(publicLocation))
            {
                if (!this.withoutArgument)
                {
                    CreateArgument(publicLocation, accessDirection, useLocationReferenceValue);
                }
                equivalentLocation = new InlinedLocationReference(publicLocation, this.metadata.CurrentActivity, accessDirection);
                return(true);
            }

            equivalentLocation = null;
            return(false);
        }
 public static bool TryGetArgumentDirectionAndType(Type propertyType, out ArgumentDirection direction, out Type argumentType)
 {
     direction    = ArgumentDirection.In;
     argumentType = TypeHelper.ObjectType;
     if (propertyType.IsGenericType)
     {
         argumentType = propertyType.GetGenericArguments()[0];
         Type genericTypeDefinition = propertyType.GetGenericTypeDefinition();
         if (genericTypeDefinition == inArgumentGenericType)
         {
             return(true);
         }
         if (genericTypeDefinition == outArgumentGenericType)
         {
             direction = ArgumentDirection.Out;
             return(true);
         }
         if (genericTypeDefinition == inOutArgumentGenericType)
         {
             direction = ArgumentDirection.InOut;
             return(true);
         }
     }
     else
     {
         if (propertyType == inArgumentType)
         {
             return(true);
         }
         if (propertyType == outArgumentType)
         {
             direction = ArgumentDirection.Out;
             return(true);
         }
         if (propertyType == inOutArgumentType)
         {
             direction = ArgumentDirection.InOut;
             return(true);
         }
     }
     return(false);
 }
Beispiel #31
0
        protected internal Argument(string name, ArgumentDirection direction, bool isReturnValue, StateVariable relatedStateVariable)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (isReturnValue && direction == ArgumentDirection.In)
            {
                throw new ArgumentException("If the argument is a return value, it must have an 'Out' direction.");
            }
            if (relatedStateVariable == null)
            {
                throw new ArgumentNullException("relatedStateVariable");
            }

            this.name                   = name;
            this.direction              = direction;
            this.is_return_value        = isReturnValue;
            this.related_state_variable = relatedStateVariable;
        }
Beispiel #32
0
        public RuntimeArgument(string name, Type argumentType, ArgumentDirection direction, bool isRequired, List <string> overloadGroupNames)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw CoreWf.Internals.FxTrace.Exception.ArgumentNullOrEmpty("name");
            }

            if (argumentType == null)
            {
                throw CoreWf.Internals.FxTrace.Exception.ArgumentNull("argumentType");
            }

            ArgumentDirectionHelper.Validate(direction, "direction");

            _name               = name;
            _type               = argumentType;
            this.Direction      = direction;
            this.IsRequired     = isRequired;
            _overloadGroupNames = overloadGroupNames;
        }
Beispiel #33
0
 public RuntimeDelegateArgument(string name, System.Type type, ArgumentDirection direction, DelegateArgument boundArgument)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw FxTrace.Exception.ArgumentNullOrEmpty("name");
     }
     if (type == null)
     {
         throw FxTrace.Exception.ArgumentNull("type");
     }
     ArgumentDirectionHelper.Validate(direction, "direction");
     if (boundArgument != null)
     {
         boundArgument.Bind(this);
     }
     this.Name          = name;
     this.Type          = type;
     this.Direction     = direction;
     this.BoundArgument = boundArgument;
 }
 public RuntimeDelegateArgument(string name, System.Type type, ArgumentDirection direction, DelegateArgument boundArgument)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw FxTrace.Exception.ArgumentNullOrEmpty("name");
     }
     if (type == null)
     {
         throw FxTrace.Exception.ArgumentNull("type");
     }
     ArgumentDirectionHelper.Validate(direction, "direction");
     if (boundArgument != null)
     {
         boundArgument.Bind(this);
     }
     this.Name = name;
     this.Type = type;
     this.Direction = direction;
     this.BoundArgument = boundArgument;
 }
Beispiel #35
0
        public RuntimeDelegateArgument(string name, Type type, ArgumentDirection direction, DelegateArgument boundArgument)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw FxTrace.Exception.ArgumentNullOrEmpty(nameof(name));
            }

            ArgumentDirectionHelper.Validate(direction, "direction");

            if (boundArgument != null)
            {
                // Validations that the bound argument matches are done
                // in CacheMetadata for ActivityDelegate.

                boundArgument.Bind(this);
            }

            this.Name          = name;
            this.Type          = type ?? throw FxTrace.Exception.ArgumentNull(nameof(type));
            this.Direction     = direction;
            this.BoundArgument = boundArgument;
        }
        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            Argument          target          = null;
            ArgumentDirection direction       = ArgumentDirection.In;
            string            directionString = parameter as string;

            if (!string.IsNullOrEmpty(directionString))
            {
                direction = (ArgumentDirection)Enum.Parse(typeof(ArgumentDirection), directionString);
            }

            Activity  expression = null;
            ModelItem valueExpressionModelItem = value as ModelItem;

            if (valueExpressionModelItem != null && typeof(Activity).IsAssignableFrom(valueExpressionModelItem.ItemType))
            {
                expression = (Activity)valueExpressionModelItem.GetCurrentValue();
            }
            ActivityWithResult activityWithResult = expression as ActivityWithResult;

            if (expression != null && activityWithResult != null)
            {
                // In the In case the expression is of type Activity<T> so we want to create InArgument<T>
                // In Out and InOut case the expresion is Activity<Location<T>> we want to create OutArgument<T>,InOutArgument<T>
                Type argumentType;
                if (direction == ArgumentDirection.In)
                {
                    argumentType = activityWithResult.ResultType;
                }
                else
                {
                    // if expression type is Location<T> argument type is T
                    argumentType = activityWithResult.ResultType.GetGenericArguments()[0];
                }
                target            = Argument.Create(argumentType, direction);
                target.Expression = activityWithResult;
            }
            return(new object[] { target });
        }
 internal static bool IsDefined(ArgumentDirection direction)
 {
     return (direction == ArgumentDirection.In || direction == ArgumentDirection.Out || direction == ArgumentDirection.InOut);
 }
 public ServiceActionArgument(string name, string type, ArgumentDirection direction)
 {
     Name = name;
     Type = type;
     Direction = direction;
 }
        internal void CreateArgument(LocationReference sourceReference, ArgumentDirection accessDirection, bool useLocationReferenceValue = false)
        {
            ActivityWithResult expression = ActivityUtilities.CreateLocationAccessExpression(sourceReference, accessDirection != ArgumentDirection.In, useLocationReferenceValue);

            AddGeneratedArgument(sourceReference.Type, accessDirection, expression);
        }
 public static bool IsOut(ArgumentDirection direction)
 {
     return (direction == ArgumentDirection.Out) || (direction == ArgumentDirection.InOut);
 }
Beispiel #41
0
 public DvArgument(string name, DvStateVariable relatedStateVariable, ArgumentDirection direction) :
     this(name, relatedStateVariable, direction, false) { }
 protected virtual Argument CreateArgument(string name, ArgumentDirection direction, bool isRetVal, StateVariable relatedStateVariable)
 {
     return new Argument (this, direction, isRetVal, relatedStateVariable);
 }
Beispiel #43
0
 internal static bool IsDefined(ArgumentDirection direction)
 {
     return(direction == ArgumentDirection.In || direction == ArgumentDirection.Out || direction == ArgumentDirection.InOut);
 }
Beispiel #44
0
 public InlinedLocationReference(LocationReference innerReference, Activity validAccessor, ArgumentDirection accessDirection)
 {
     this.innerReference = innerReference;
     this.validAccessor  = validAccessor;
     this.allowReads     = accessDirection != ArgumentDirection.Out;
     this.allowWrites    = accessDirection != ArgumentDirection.In;
 }
Beispiel #45
0
 public CpArgument(CpAction parentAction, string name, CpStateVariable relatedStateVariable, ArgumentDirection direction) :
     this(parentAction, name, relatedStateVariable, direction, false) { }
Beispiel #46
0
 public static bool IsOut(ArgumentDirection direction)
 {
     return((direction == ArgumentDirection.Out) || (direction == ArgumentDirection.InOut));
 }
 internal void CreateArgument(LocationReference sourceReference, ArgumentDirection accessDirection, bool useLocationReferenceValue = false)
 {
     ActivityWithResult expression = ActivityUtilities.CreateLocationAccessExpression(sourceReference, accessDirection != ArgumentDirection.In, useLocationReferenceValue);
     AddGeneratedArgument(sourceReference.Type, accessDirection, expression);
 }
Beispiel #48
0
 public static Argument Create(Type type, ArgumentDirection direction)
 {
     return(ActivityUtilities.CreateArgument(type, direction));
 }
Beispiel #49
0
        public static void FixMessageArgument(Argument messageArgument, ArgumentDirection direction, ActivityMetadata metadata)
        {
            Type messageType = (messageArgument == null) ? TypeHelper.ObjectType : messageArgument.ArgumentType;

            AddRuntimeArgument(messageArgument, "Message", messageType, direction, metadata);
        }
        // In 4.0 the expression type for publicly inspectable auto-generated arguments was 
        // LocationReferenceValue<T>, whether the argument was actually used as an L-Value or R-Value.
        // We keep that for back-compat (useLocationReferenceValue == true), and only use the new
        // EnvironmentLocationValue/Reference classes for new activities.
        internal bool TryGetAccessToPublicLocation(LocationReference publicLocation,
            ArgumentDirection accessDirection, bool useLocationReferenceValue, out LocationReference equivalentLocation)
        {
            Fx.Assert(!useLocationReferenceValue || this.ActivityMetadata.CurrentActivity.UseOldFastPath, "useLocationReferenceValue should only be used for back-compat");

            if (this.metadata.Environment.IsVisible(publicLocation))
            {
                if (!this.withoutArgument)
                {
                    CreateArgument(publicLocation, accessDirection, useLocationReferenceValue);
                }                
                equivalentLocation = new InlinedLocationReference(publicLocation, this.metadata.CurrentActivity, accessDirection);
                return true;
            }

            equivalentLocation = null;
            return false;
        }
 void AddGeneratedArgument(Type argumentType, ArgumentDirection direction, ActivityWithResult expression)
 {
     Argument argument = ActivityUtilities.CreateArgument(argumentType, direction);
     argument.Expression = expression;
     RuntimeArgument runtimeArgument = this.metadata.CurrentActivity.AddTempAutoGeneratedArgument(argumentType, direction);
     Argument.TryBind(argument, runtimeArgument, this.metadata.CurrentActivity);
 }