Comments (9)
Escaping works.
Thank you @alirezanet for your answers and this great library.
from gridify.
Hi @agriffard,
maybe you're missing something, because I've tried this and it is working as expected 🤔
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace Gridify.Tests;
public class Issue120
{
[Fact]
public void ApplyFiltering_WhenPassedADoubleValue_ShouldWorkCorrectly()
{
var query = new List<Test>()
{
new() { PropertyDouble = 0.2 },
new() { PropertyDouble = 0.6 },
new() { PropertyDouble = 0 },
}.AsQueryable();
var result = query.ApplyFiltering("propertyDouble > 0.5").ToList();
Assert.Single(result);
}
private class Test
{
public double PropertyDouble { get; set; }
public string Other { get; set; }
}
}
from gridify.
When I try your test locally copying your code, I get the error:
from gridify.
So weird! What dotnet version are you using? and what operating system? Although OS looks irrelevant just to make sure.
from gridify.
Windows 11 22621.2283
VS 2022 Preview (but same error on VS 2022)
C:\Users\agrif>dotnet --info
SDK .NET :
Version: 8.0.100-rc.1.23455.8
Commit: e14caf947f
Environnement d'exécution :
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.100-rc.1.23455.8\
.NET workloads installed:
Il n'y a aucune charge de travail installée à afficher.
Host:
Version: 8.0.0-rc.1.23419.4
Architecture: x64
Commit: 92959931a3
RID: win-x64
.NET SDKs installed:
6.0.414 [C:\Program Files\dotnet\sdk]
7.0.401 [C:\Program Files\dotnet\sdk]
8.0.100-rc.1.23455.8 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0-rc.1.23421.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0-rc.1.23419.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0-rc.1.23420.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
from gridify.
Ow Interesting, I might know what is causing this problem,
Can you please check you Region settings on your machine? and let me know what is your decimal separator?
from gridify.
I am French so decimal point is a comma.
If I use a filter MyProperty > 0,5
this error occurs:
Unexpected token <End>, expected <FieldToken>
from gridify.
Yeah because ,
is a special character (AND), so you need to escape it. more info : https://alirezanet.github.io/Gridify/guide/filtering.html#escaping
e.g: MyProperty > 0\,5
However, I'm thinking should I ignore the culture while parsing the values or not, since probably other users have different cultural settings and might want to use it in Gridify.
For now, you have two ways to fix this issue, either you need to escape the ,
character in your queries or change it on the OS level.
I'll probably add a setting to give users control over this behavior in the next version.
from gridify.
You're welcome, happy to help.
there is also a third workaround which is changing the CurrentCulture
in your application,
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en-EN");
I've tested it and it works.
from gridify.
Related Issues (20)
- Bitwise AND custom operator
- Possibility to have the filter value of a different type of field type HOT 1
- RobiniaDocs API Explorer HOT 1
- Possibility to use Gridify (as parser) to create your own non-LINQ query builder HOT 2
- add support automatic mapping generation for child classes HOT 1
- Update documentation site dependencies (Vuepress2)
- Gridify.Elasticsearch generate DSL query (non-generic) HOT 3
- JavaScript client library HOT 3
- Creating an Abstractions Layer for Gridify
- Error "Specified method is not supported" when querying the Nested List field in Elasticsearch HOT 2
- DateTime Kind and PostgreSQL HOT 13
- IN style operator HOT 5
- Support for. NET8 HOT 4
- NativeAOT support
- Why library can not resolve IGridifyMapper<T> default in DbContext.ServiceProvider if exists HOT 1
- GRPC Support HOT 2
- Compare elements nested in a list of the root object
- Cleanup dependencies HOT 2
- Filtering based on IDictionary values
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gridify.