Ejemplo n.º 1
0
        public Filter ToFilter(QueryDescription qd, bool canAggregate)
        {
            var options           = SubTokensOptions.CanElement | SubTokensOptions.CanAnyAll | (canAggregate ? SubTokensOptions.CanAggregate : 0);
            var parsedToken       = QueryUtils.Parse(token, qd, options);
            var expectedValueType = operation.IsList() ? typeof(ObservableCollection <>).MakeGenericType(parsedToken.Type.Nullify()) : parsedToken.Type;

            var val = value is JToken ?
                      ((JToken)value).ToObject(expectedValueType, JsonSerializer.Create(GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings)) :
                      value;

            return(new Filter(parsedToken, operation, val));
        }
Ejemplo n.º 2
0
        public override Filter ToFilter(QueryDescription qd, bool canAggregate)
        {
            var options           = SubTokensOptions.CanElement | SubTokensOptions.CanAnyAll | (canAggregate ? SubTokensOptions.CanAggregate : 0);
            var parsedToken       = QueryUtils.Parse(token, qd, options);
            var expectedValueType = operation.IsList() ? typeof(ObservableCollection <>).MakeGenericType(parsedToken.Type.Nullify()) : parsedToken.Type;

            var val = value is JToken jtok?
                      jtok.ToObject(expectedValueType, JsonSerializer.Create(SignumServer.JsonSerializerSettings)) :
                          value;

            return(new FilterCondition(parsedToken, operation, val));
        }
Ejemplo n.º 3
0
 public Filter(QueryToken token, FilterOperation operation, object value)
 {
     this.token     = token;
     this.operation = operation;
     this.value     = ReflectionTools.ChangeType(value, operation.IsList() ? typeof(IEnumerable <>).MakeGenericType(Token.Type.Nullify()) : Token.Type);
 }
Ejemplo n.º 4
0
 public Filter(QueryToken token, FilterOperation operation, object value)
 {
     this.token = token;
     this.operation = operation;
     this.value = ReflectionTools.ChangeType(value, operation.IsList() ? typeof(IEnumerable<>).MakeGenericType(Token.Type.Nullify()) : Token.Type);
 }