Ejemplo n.º 1
0
        private TagMapLeaf AddEnumerableLeaf(Stack <TagMapParent> parents, PropertyInfo property, FixTagAttribute fixTagAttribute, RepeatingGroupAttribute repeatingGroup, TypeConverterAttribute?typeConverter, int key, Type innerType)
        {
            BaseSetter setter;

            if (typeConverter != null)
            {
                setter = _propertySetterFactory.GetTypeConvertingSetter(property);
            }
            else
            {
                setter = _propertySetterFactory.GetSetter(property, innerType);
            }
            var value = TagMapLeaf.CreateEnumerable(property, repeatingGroup.Tag, innerType, setter);

            if (parents.Any())
            {
                value.Parents = parents.ToList();
            }
            if (typeConverter != null)
            {
                value.TypeConverterName = typeConverter.ConverterTypeName;
            }
            value.IsEncoded = fixTagAttribute.Encoded;
            _map.TryAdd(key, value);
            return(value);
        }
Ejemplo n.º 2
0
        private TagMapLeaf AddLeafNode(Stack <TagMapParent> parents, PropertyInfo property, FixTagAttribute fixTagAttribute, TypeConverterAttribute?typeConverter, int key)
        {
            BaseSetter setter;

            if (typeConverter != null)
            {
                setter = _propertySetterFactory.GetTypeConvertingSetter(property);
            }
            else
            {
                setter = _propertySetterFactory.GetSetter(property, property.PropertyType);
            }
            TagMapLeaf value = new TagMapLeaf(property, setter)
            {
                IsEncoded = fixTagAttribute.Encoded
            };

            if (parents.Any())
            {
                value.Parents = parents.ToList();
            }
            if (typeConverter != null)
            {
                value.TypeConverterName = typeConverter.ConverterTypeName;
            }
            _map.TryAdd(key, value);
            return(value);
        }