-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With UseParameterizedNamesInDynamicQuery, can't compare enum type with String #668
Comments
Yes! I check this now. |
So, works fine with "=" operator. But, I need also the case with "in ()" like this : [Fact]
public void When_UseParameterizedNamesInDynamicQuery_IsTrue_WrappedStringValueEnums_Should_Be_Unwrapped()
{
// Arrange
var list = new List<Customer>
{
new()
{
Name = "Duffy",
GenderType = Gender.Female
},
new()
{
Name = "Garry",
GenderType = Gender.Male
},
new()
{
Name = "Garry",
GenderType = Gender.Other
},
new()
{
Name = "Garry",
GenderType = Gender.Male
}
};
var config = new ParsingConfig
{
UseParameterizedNamesInDynamicQuery = true
};
// Act
var result = list.AsQueryable().Where(config, "GenderType in (\"Female\", \"Other\")").ToArray();
// Assert
result.Should().HaveCount(2);
} I see if I can contribute to solve it. |
Good news 😊 var result = list.AsQueryable().Where(config, "GenderType in (\"Female\", \"Other\")").ToArray(); Works too: var result = list.AsQueryable().Where(config, "GenderType = 2").ToArray(); But don't works in this case: var result = list.AsQueryable().Where(config, "GenderType in (0, 2)").ToArray();` I created a branch neilbgr-668-enum-string-wrapped with new tests and the fix in |
You can make a pull request to my branch. |
…n-operator and left operand is enum (zzzprojects#668)
I did merge your branch into mine. please review my PR And if you have more updates, create a new branch (with different name) and make a PR to my branch. |
…erator for Enum (#672) * Fixed ExpressionParser when WrappedValue-string is used for equals-operator to compare Enum * . * . * Partial fixed ExpressionParser when WrappedValue-string is used for in-operator and left operand is enum (#668) * Fix * . --------- Co-authored-by: neilbgr <[email protected]>
1. Description
When
UseParameterizedNamesInDynamicQuery = true
in config (for best perfs), can not compare enum type withString
.2. Project fiddle
https://dotnetfiddle.net/ZKJC6i
3. Source
4. Console result
5. Related issue
#645
(Sorry, me again...)
The text was updated successfully, but these errors were encountered: