-
Notifications
You must be signed in to change notification settings - Fork 158
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
Add dynamic properties support for any and all operators #1322
Add dynamic properties support for any and all operators #1322
Conversation
a6c74da
to
f32d433
Compare
test/Microsoft.AspNetCore.OData.E2E.Tests/DollarFilter/DollarFilterDataSource.cs
Outdated
Show resolved
Hide resolved
@@ -697,7 +735,7 @@ public virtual Expression BindAllNode(AllNode allNode, QueryBinderContext contex | |||
{ | |||
CheckArgumentNull(allNode, context); | |||
|
|||
// context.EnterLambdaScope(); | |||
// context.EnterLambdaScope(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@habbes I didn't add the line/comment. It existed. It was only formatted since it had an unnecessary leading space. I don't know if I should remove it altogether...
f32d433
to
2400b3c
Compare
2400b3c
to
be7b47d
Compare
@@ -1487,42 +1546,42 @@ private Expression BindDynamicPropertyAccessExpression(SingleValueOpenPropertyAc | |||
/// <summary> | |||
/// Creates an expression for retrieving a dynamic property from the dynamic properties container property. | |||
/// </summary> | |||
/// <param name="dynamicPropertiesContainerExpr">The dynamic properties container property access expression.</param> | |||
/// <param name="containerPropertyAccessExpr">The dynamic properties container property access expression.</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are passing containerPropertyAccessExpr
and not dynamicPropertiesContainerExpr
, should you also change the doc string for this parameter as well
/// <param name="containerPropertyAccessExpr">The dynamic properties container property access expression.</param> | |
/// <param name="containerPropertyAccessExpr">The properties container property access expression.</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe The container property access expression
. Otherwise, The properties container property access expression
would sound inaccurate given the explanation I have provided here #1322 (comment)
"The dynamic properties container property access expression" is captures the definition accurately too
Expression.Constant(propertyName)); | ||
|
||
// ContainsKey method | ||
MethodCallExpression containsKeyExpression = Expression.Call( | ||
dynamicPropertiesContainerExpr, | ||
dynamicPropertiesContainerExpr.Type.GetMethod("ContainsKey"), | ||
containerPropertyAccessExpr, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the different between dynamicPropertiesContainerExpr
and containerPropertyAccessExpr
. Or do they mean the same and only the name had changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WanjohiSammy I just thought I should harmonize the name with how it's named elsewhere. Otherwise, both can be used to refer to the property of type IDictionary<string, object>
(or any of it's implementing types) that we use to store dynamic properties. We can refer to it as the "dynamic properties container property" (mouthful/with 'property' repeated) or just "container property" (shorter).
287b8e0
Description
Add dynamic properties support for
any
andall
operators.Fixes OData/odata.net#3059
Fixes OData/WebApi#770
Fixes partially #1325
The
any
andall
operators appear after a collection-valued property in a$filter
expression as follows:$filter=...CollectionValuedProperty/any(...)
$filter=...CollectionValuedProperty/any(...)
If the collection-valued property is a dynamic property, the parser in ODL defers the actual binding to the upstream libraries. The late binding logic needs to do the following:
any
/all
delegate to the propertyIEnumerable
and cast it toIEnumerable
, or throw an exception if it's notIEnumerable
This pull request implements support the following expressions among many others:
Additional Details
Port change to 8.x and 7.x