コード例 #1
0
        public virtual object Execute(ModelData data, IServiceLocator services)
        {
            _expander.PushContext(new VariableExpanderContext(data, new Dictionary <string, object>()));

            try
            {
                var arguments = new TransformArguments(_services, _arguments.ToDictionary(_ => _.Name, _ => _.Resolve(data)));
                var context   = new TransformContext(data, arguments, services);
                var value     = _transform.Execute(context);

                if (value is IDynamicValue)
                {
                    value = value.As <IDynamicValue>().Resolve(_services);
                }

                if (value != null)
                {
                    _path.Set(data, value);
                }

                return(value);
            }
            finally
            {
                _expander.PopContext();
            }
        }
コード例 #2
0
 public TransformContext(ModelData model, TransformArguments arguments, IServiceLocator services)
 {
     Model     = model;
     Arguments = arguments;
     _services = services;
 }