Exemplo n.º 1
0
        public object GetValue(Type valueType, object defaultValue)
        {
            if (_valueNode == null)
            {
                return(PluginUtility.ResolveValue(_owner, _rawValue, _name, valueType, defaultValue));
            }

            var result = _valueNode.UnwrapValue(ObtainMode.Auto, _owner);

            if (valueType != null)
            {
                result = Zongsoft.Common.Convert.ConvertValue(result, valueType, defaultValue);
            }

            return(result);
        }
            public object GetValue(Type valueType)
            {
                var original = System.Threading.Interlocked.CompareExchange(ref _evaluateValueRequired, 1, 0);

                if (original == 0)
                {
                    if (valueType != null && string.IsNullOrEmpty(_parameterTypeName))
                    {
                        _value = PluginUtility.ResolveValue(_constructor.Builtin, _rawValue, null, valueType, null);
                    }
                    else
                    {
                        _value = PluginUtility.ResolveValue(_constructor.Builtin, _rawValue, null, this.ParameterType, null);
                    }
                }

                return(_value);
            }