예제 #1
0
        private QueryTree GetAttributes(Type type, int depth, string rootName)
        {
            QueryTree result = new QueryTree(type, rootName);

            try
            {
                foreach (var prop in type.GetProperties())
                {
                    if (mRecordNames.Contains(prop.PropertyType))
                    {
                        if (depth == 0)
                        {
                            result.Add(GetAttributes(prop.PropertyType, depth + 1, prop.Name));
                        }
                    }
                    else if (prop.PropertyType.Name.Contains("ICollection"))
                    {
                        if (depth == 0)
                        {
                            result.Add(
                                GetAttributes(
                                    prop.PropertyType.GenericTypeArguments.First(),
                                    depth + 1,
                                    prop.Name
                                    )
                                );
                        }
                    }
                    else
                    {
                        result.Add(prop.PropertyType, prop.Name);
                    }
                }
            }
            catch (TypeLoadException)
            {
                throw;
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        /// Constructor</summary>
        /// <param name="parentNode">Node to receive child</param>
        public QueryDomNodeProperty(QueryNode parentNode)
        {
            QueryTree.Add(parentNode, this);

            QueryTree.AddLabel(this, "whose name");
            new QueryPropertyNameInput(this, StringQuery.Matches, false);
            QueryTree.AddLabel(this, "and whose");
            QueryOption stringOrNumberOption = QueryTree.AddOption(this);

            new QueryPropertyValueAsStringInput(QueryTree.AddOptionItem(stringOrNumberOption, "string value", 0), StringQuery.All, true);
            new QueryPropertyValueAsNumberInput(QueryTree.AddOptionItem(stringOrNumberOption, "numerical value", 0), NumericalQuery.All, true);
        }