コード例 #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).OrderByDescending(a => a.Priority).ThenBy(a => a.ToString()))
            {
                if (!dictonary.ContainsKey(item.Key))
                {
                    dictonary.Add(item.Key, item);
                }
            }

            return(dictonary.Values.ToList());
        }
        else
        {
            return(token.SubTokensInternal(options));
        }
    }
コード例 #2
0
        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();
        }
コード例 #3
0
        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.hasOrderAdapter = QueryUtils.OrderAdapters.ContainsKey(token.Type);
            this.preferEquals    = token.Type == typeof(string) &&
                                   token.GetPropertyRoute() is PropertyRoute pr &&
                                   typeof(Entity).IsAssignableFrom(pr.RootType) &&
                                   Schema.Current.HasSomeIndex(pr);
            this.unit          = a.Unit;
            this.format        = a.Format;
            this.displayName   = a.DisplayName;
            this.propertyRoute = token.GetPropertyRoute()?.ToString();
        }