public OperationElement(string name, string summary, AmlDataType dataType, params string[] values) : this(name, summary)
 {
     _valueTypes = new List <AmlTypeDefinition>()
     {
         AmlTypeDefinition.FromDefinition(dataType, values)
     };
 }
Beispiel #2
0
        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);
        }
        public OperationElement WithAttribute(string name, string summary, AmlDataType dataType, params string[] values)
        {
            var attr = GetOrAddAttribute(name);

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