-
-
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
Value typed property from subquery are casted as object
#775
Labels
Comments
If adding this condition after the else, my case is fixed but 2 unit tests failed... From for (var i = 0; i < args.Length; i++)
{
if (args[i].Type != methodData.Args[i].Type &&
args[i].Type.IsArray && methodData.Args[i].Type.IsArray &&
args[i].Type != typeof(string) && methodData.Args[i].Type == typeof(object[]))
{
args[i] = _expressionHelper.ConvertAnyArrayToObjectArray(args[i]);
}
else if (methodData.Args[i].Type != typeof(object)) // Fix (or hack?)
{
args[i] = methodData.Args[i];
}
} |
My unit test (in file public void Issue775()
{
var list = new List<Customer>
{
new()
{
CustomerID = 1,
Name = "Duffy",
GenderType = Gender.Female
},
new()
{
CustomerID = 2,
Name = "Garry",
GenderType = Gender.Male
},
new()
{
CustomerID = 3,
Name = "John",
GenderType = Gender.Male
}
};
var config = new ParsingConfig
{
UseParameterizedNamesInDynamicQuery = true
};
var subquery = list.AsQueryable().Where(_ => _.CustomerID == 2);
//var subquery = list.AsQueryable().Where("CustomerID == 2");
// Act
var result = list.AsQueryable().Where(config, "CustomerID != @0.Select(CustomerID).FirstOrDefault()", subquery).ToArray();
// Assert
result.Should().HaveCount(2);
} |
I was just also debugging this part. The root cause is that object is detected from that IEnnumerable helper class. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
All value typed properties read from subquery are casted as
object
and can not be compared with other same typed value.Even trying with
WrappedConstant()
.Fiddle that reproduce the issue: https://dotnetfiddle.net/slGSSp
Thanks
The text was updated successfully, but these errors were encountered: