Ejemplo n.º 1
0
        public OpenType MapType(Type plainNetType, MapTypeDelegate mapNestedTypeCallback)
        {
            List <string>   names        = new List <string>();
            List <string>   descriptions = new List <string>();
            List <OpenType> types        = new List <OpenType>();

            foreach (PropertyInfo propertyInfo in plainNetType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
            {
                if (propertyInfo.CanRead && propertyInfo.GetIndexParameters().Length == 0)
                {
                    names.Add(AttributeUtils.GetOpenTypeName(propertyInfo));
                    descriptions.Add(AttributeUtils.GetOpenTypeDescription(propertyInfo));
                    types.Add(mapNestedTypeCallback(propertyInfo.PropertyType));
                }
            }

            return(new CompositeType(AttributeUtils.GetOpenTypeName(plainNetType), AttributeUtils.GetOpenTypeDescription(plainNetType), names, descriptions, types));
        }
Ejemplo n.º 2
0
        public OpenType MapType(Type plainNetType, MapTypeDelegate mapNestedTypeCallback)
        {
            Type         elementType = GetElementType(plainNetType);
            OpenTypeKind kind        = ResolveMappedTypeKind(elementType);

            if (kind == OpenTypeKind.ArrayType)
            {
                return(new ArrayType(1, mapNestedTypeCallback(elementType)));
            }
            else
            {
                CompositeType mappedElementType = (CompositeType)mapNestedTypeCallback(elementType);
                CompositeType rowType           = MakeRowType(mappedElementType);
                return(new TabularType(
                           string.Format(CultureInfo.InvariantCulture, "{0} table", AttributeUtils.GetOpenTypeName(elementType)),
                           string.Format(CultureInfo.InvariantCulture, "Table of {0}", AttributeUtils.GetOpenTypeName(elementType)),
                           rowType, new string[] { CollectionIndexColumnName }));
            }
        }