Inheritance: QueryToken
Beispiel #1
0
        static List <QueryToken> SubTokensBasic(QueryToken token, QueryDescription qd, SubTokensOptions options)
        {
            if (token == null)
            {
                if (MergeEntityColumns != null && !MergeEntityColumns())
                {
                    return(qd.Columns.Select(cd => (QueryToken) new ColumnToken(cd, qd.QueryName)).ToList());
                }

                var dictonary = qd.Columns.Where(a => !a.IsEntity).Select(cd => (QueryToken) new ColumnToken(cd, qd.QueryName)).ToDictionary(t => t.Key);

                var entity = new ColumnToken(qd.Columns.SingleEx(a => a.IsEntity), qd.QueryName);

                dictonary.Add(entity.Key, entity);

                foreach (var item in entity.SubTokensInternal(options).OrderBy(a => a.ToString()))
                {
                    if (!dictonary.ContainsKey(item.Key))
                    {
                        dictonary.Add(item.Key, item);
                    }
                }

                return(dictonary.Values.ToList());
            }
            else
            {
                return(token.SubTokensInternal(options));
            }
        }
Beispiel #2
0
        static List<QueryToken> SubTokensBasic(QueryToken token, QueryDescription qd)
        {
            if (token == null)
            {
                if (MergeEntityColumns != null && !MergeEntityColumns())
                    return qd.Columns.Select(cd => (QueryToken)new ColumnToken(cd, qd.QueryName)).ToList();

                var dictonary = qd.Columns.Where(a => !a.IsEntity).Select(cd => (QueryToken)new ColumnToken(cd, qd.QueryName)).ToDictionary(t => t.Key);

                var entity = new ColumnToken(qd.Columns.SingleEx(a => a.IsEntity), qd.QueryName);

                dictonary.Add(entity.Key, entity);

                foreach (var item in entity.SubTokensInternal().OrderBy(a => a.ToString()))
                {
                    if (!dictonary.ContainsKey(item.Key))
                    {
                        dictonary.Add(item.Key, item);
                    }
                }

                return dictonary.Values.ToList();

            }
            else
                return token.SubTokensInternal();
        }
        public ColumnDescriptionTS(ColumnDescription a, object queryName)
        {
            var token = new ColumnToken(a, queryName);

            this.name = a.Name;
            this.type = new TypeReferenceTS(a.Type, a.Implementations);
            this.filterType = QueryUtils.TryGetFilterType(a.Type);
            this.typeColor = token.TypeColor;
            this.niceTypeName = token.NiceTypeName;
            this.isGroupable = token.IsGroupable;
            this.unit = a.Unit;
            this.format = a.Format;
            this.displayName = a.DisplayName;
            this.propertyRoute = token.GetPropertyRoute()?.ToString();
        }