Exemplo n.º 1
0
        public IEnumerable <AmlTypeDefinition> GetTypeDefinitions()
        {
            switch (Type)
            {
            case PropertyType.boolean:
                return(new[] { AmlTypeDefinition.FromDefinition(AmlDataType.Boolean) });

            case PropertyType.date:
                return(new[] { AmlTypeDefinition.FromDefinition(AmlDataType.Date) });

            case PropertyType.item:
                return(Restrictions.Select(r => AmlTypeDefinition.FromDefinition(AmlDataType.Item, r)));

            case PropertyType.list:
                return(new[] { AmlTypeDefinition.FromDefinition(AmlDataType.List, DataSource) });

            case PropertyType.number:
                return(new[] { AmlTypeDefinition.FromDefinition(AmlDataType.Float) });

            case PropertyType.text:
                return(new[] { AmlTypeDefinition.FromDefinition(AmlDataType.String) });

            default:
                return(new[] { AmlTypeDefinition.FromDefinition(AmlDataType.Unknown) });
            }
        }
        public static AmlTypeDefinition FromDefinition(AmlDataType dataType, params string[] values)
        {
            var typeDefn = new AmlTypeDefinition()
            {
                Type = dataType
            };

            if (values?.Length > 0)
            {
                switch (typeDefn.Type)
                {
                case AmlDataType.Enum:
                    typeDefn._values = values;
                    break;

                case AmlDataType.Inherit:
                case AmlDataType.Item:
                case AmlDataType.ItemName:
                case AmlDataType.List:
                case AmlDataType.MultiValueList:
                case AmlDataType.OrderBy:
                case AmlDataType.SelectList:
                case AmlDataType.WhereClause:
                    typeDefn.Source = values[0];
                    break;
                }
            }

            return(typeDefn);
        }
Exemplo n.º 3
0
 public AmlDocumentation(string name, string summary, AmlDataType dataType, params string[] values) : this(name, summary)
 {
     _valueTypes = new List <AmlTypeDefinition>()
     {
         AmlTypeDefinition.FromDefinition(dataType, values)
     };
 }
Exemplo n.º 4
0
        public AmlDocumentation WithAttribute(string name, string summary, AmlDataType dataType, params string[] values)
        {
            var attr = GetOrAddAttribute(name);

            attr.Summary     = summary;
            attr._valueTypes = new List <AmlTypeDefinition>()
            {
                AmlTypeDefinition.FromDefinition(dataType, values)
            };
            return(this);
        }