Пример #1
0
        protected override void CacheMetadata(CodeActivityMetadata metadata)
        {
            Collection <RuntimeArgument> arguments = new Collection <RuntimeArgument>();

            Type targetObjectType = TypeHelper.ObjectType;

            if (this.TargetObject != null)
            {
                targetObjectType = this.TargetObject.ArgumentType;
            }

            RuntimeArgument targetObjectArgument = new RuntimeArgument("TargetObject", targetObjectType, ArgumentDirection.In);

            metadata.Bind(this.TargetObject, targetObjectArgument);
            arguments.Add(targetObjectArgument);

            _resultArgument = new RuntimeArgument("Result", typeof(TResult), ArgumentDirection.Out);
            metadata.Bind(this.Result, _resultArgument);
            arguments.Add(_resultArgument);

            // Parameters are named according to MethodInfo name if DetermineMethodInfo
            // succeeds, otherwise arbitrary names are used.
            _methodResolver = CreateMethodResolver();

            _methodResolver.DetermineMethodInfo(metadata, s_funcCache, s_locker, ref _methodExecutor);
            _methodResolver.RegisterParameters(arguments);

            metadata.SetArgumentsCollection(arguments);

            _methodResolver.Trace();

            if (_methodExecutor != null)
            {
                _methodExecutor.Trace(this);
            }
        }