Ejemplo n.º 1
0
        public bool SetValue(string value, object options)
        {
            if (_attribute is OptionListAttribute)
            {
                return(SetValueList(value, options));
            }

            if (ReflectionHelper.IsNullableType(_property.PropertyType))
            {
                return(ReceivedValue = _propertyWriter.WriteNullable(value, options));
            }

            return(ReceivedValue = _propertyWriter.WriteScalar(value, options));
        }
Ejemplo n.º 2
0
        public bool MapValueItem(string item)
        {
            if (IsValueOptionDefined &&
                _valueOptionIndex < _valueOptionAttributeList.Count)
            {
                var valueOption = _valueOptionAttributeList[_valueOptionIndex++];

                var propertyWriter = new PropertyWriter(valueOption.Left, _parsingCulture);

                return(ReflectionHelper.IsNullableType(propertyWriter.Property.PropertyType) ?
                       propertyWriter.WriteNullable(item, _target) :
                       propertyWriter.WriteScalar(item, _target));
            }

            return(IsValueListDefined && AddValueItem(item));
        }