alexmurari / exprelsior Goto Github PK
View Code? Open in Web Editor NEWA .NET Standard lambda expression generator for creating dynamic predicates. Exprelsior!
License: MIT License
A .NET Standard lambda expression generator for creating dynamic predicates. Exprelsior!
License: MIT License
I am building a query with several AND and OR and I want to use brackets to group some expressions. My expression is the following :
eq('CodePropriete', 'MH')+AND+(gt('NbPiedsParcelle', '2')+OR+gt('NbRangsParcelle', '2'))+AND+eq('Cepage', 'Chardonnay')
I would expect this to be translated to (CodePropriete = MH) AND (NbPiedsParcelle > 2 OR NbRangsParcelle > 2) AND Cepage = Chardonnnay
but my tests suggests it is translated to ((((CodePropriete = MH) AND NbPiedsParcelle > 2) OR NbRangsParcelle > 2) AND Cepage = Chardonnnay)
.
Am I doing something wrong ?
Currently only simple queries are tested, there is no tests for the query composition feature (+AND+, +OR+).
Hey there!
I've been giving such a heavy use to this useful and fantastic piece of software that I've been able to spot another issue.
Let me explain the scenario:
WHERE x IN ("M", "W")
As you can see in the image below, the expression cov('PlanGroup', ['W', 'M'])
has been created to achieve a WHERE IN
-like predicate.
Once built, I save the returned Expression
in the filterExpression
variable, as shown at line 55 in the image below.
That breakpoint doesn't tell us much about what's happening in the expression. That is why in the next image, I am showing the Debug View
property in the Text Visualizer. It all looks in order.
However, once is executed in the LINQ Where
method, an exception is raised:
Is there something I am missing, like configurations or similar? or is it just something out of the scope of the library? Let me know if more information is needed.
I am using Entity Framework Core and Pomelo to query a MySQL database:
Just to mention that when an expression is built with the comparison operator cov
but with an int[]
type value, everything works fine.
As I faced this issue, I tried to debug it myself to contribute to such a useful tool. However, this error message was preventing me from building the solution.
This happens because of the random nature of the data used by the unit tests (Bogus project).
Hey there!
Thanks for making such a useful tool! I discovered it the last month, I have been using it since.
However, I am finding some issues while working with the int? type.
According to the documentation, there is no distinction between the properties of different types while creating a query (https://github.com/alexmurari/Exprelsior#elements-syntax), I guess the type is inferred by the generic type given to the CreateBinaryFromQuery
method.
It is also important to mention that if I use the CreateBinary
method to create the same expression, it gets created without problems:
It's not visible in the image, but the type of the Po
prop which is member of the class VwNcrViewLog
is int?
.
Am I missing something by working with int and int?
values?
Thanks in advance!
Add TimeSpan support for the expression builder and dynamic query.
First, thank you so much for publishing this project, I was looking for a lightweight way of passing and building filters and this is a great solution.
The name property of the Parameter constructor is optional but I was using this to build filters for an app using MongoDB Driver for C# and it required the name property to be set for some reason.
https://docs.microsoft.com/en-us/dotnet/api/system.linq.expressions.expression.parameter
in ExpressionBuilder\ExpressionBuilder.cs line 170 change from:
var param = Expression.Parameter(typeof(T));
to
var param = Expression.Parameter(typeof(T), propertyNameOrPath);
if your object has an enum value it cannot be used as a search term, you get an error stating you cant compare string to int.
I am starting to look into where/how to add the type checking for enum values any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.