protected override string?PropertyValidation(PropertyInfo pi) { if (pi.Name == nameof(Token) && Token != null && Token.ParseException == null) { return(QueryUtils.CanColumn(Token.Token)); } return(base.PropertyValidation(pi)); }
public static void CanColumnDecorator(QueryToken qt, HtmlTag option) { string canColumn = QueryUtils.CanColumn(qt); if (canColumn.HasText()) { option.Attr("data-column", canColumn); } }
protected override string?PropertyValidation(PropertyInfo pi) { if (pi.Name == nameof(Token) && Token != null && Token.ParseException == null) { return(QueryUtils.CanColumn(Token.Token)); } if (pi.Name == nameof(SummaryToken) && SummaryToken != null && SummaryToken.ParseException == null) { return(QueryUtils.CanColumn(SummaryToken.Token) ?? (SummaryToken.Token is not AggregateToken ? SearchMessage.SummaryHeaderMustBeAnAggregate.NiceToString() : null)); } return(base.PropertyValidation(pi)); }
List <QueryToken> tokenBuilder_SubTokensEvent(QueryToken arg) { string canColumn = QueryUtils.CanColumn(arg); btCreateColumn.IsEnabled = string.IsNullOrEmpty(canColumn); btCreateColumn.ToolTip = canColumn; string canFilter = QueryUtils.CanFilter(arg); btCreateFilter.IsEnabled = string.IsNullOrEmpty(canFilter); btCreateFilter.ToolTip = canFilter; return(arg.SubTokens(Description, SubTokensOptions.CanAnyAll | SubTokensOptions.CanElement)); }
static Expression <Func <object, object> > TupleConstructor(BuildExpressionContext context, HashSet <QueryToken> tokens, out BuildExpressionContext newContext) { string str = tokens.Select(t => QueryUtils.CanColumn(t)).NotNull().ToString("\r\n"); if (str == null) { throw new ApplicationException(str); } List <Expression> expressions = tokens.Select(t => t.BuildExpression(context)).ToList(); Expression ctor = TupleReflection.TupleChainConstructor(expressions); var pe = Expression.Parameter(typeof(object)); newContext = new BuildExpressionContext( ctor.Type, pe, tokens.Select((t, i) => new { Token = t, Expr = TupleReflection.TupleChainProperty(Expression.Convert(pe, ctor.Type), i) }).ToDictionary(t => t.Token, t => t.Expr)); return(Expression.Lambda <Func <object, object> >( (Expression)Expression.Convert(ctor, typeof(object)), context.Parameter)); }