-
Notifications
You must be signed in to change notification settings - Fork 161
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
Support type cast in group by #1182
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree |
IEdmStructuredTypeReference structured = node.StructuredTypeReference; | ||
Contract.Assert(structured != null, "NS casts can contain only structured types"); | ||
|
||
Type clrType = Model.GetClrType(structured); |
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.
Could we stick with using var for consistency ?
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.
This method is based on the following method :
AspNetCoreOData/src/Microsoft.AspNetCore.OData/Query/Expressions/QueryBinder.cs
Lines 692 to 703 in 7e2e707
public virtual Expression BindSingleResourceCastNode(SingleResourceCastNode node, QueryBinderContext context) | |
{ | |
CheckArgumentNull(node, context); | |
IEdmStructuredTypeReference structured = node.StructuredTypeReference; | |
Contract.Assert(structured != null, "NS casts can contain only structured types"); | |
Type clrType = context.Model.GetClrType(structured); | |
Expression source = BindCastSourceNode(node.Source, context); | |
return Expression.TypeAs(source, clrType); | |
} |
There doesn't seem to be any consistency between explicit types and var
in the project.
But if someone of the organization feels the same way, I'll make the changes.
|
||
Type clrType = Model.GetClrType(structured); | ||
|
||
Expression source = Bind(node.Source); |
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.
Could we stick with using var for consistency ?
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.
See previous comment.
{ | ||
List<Product> productList = new List<Product>(); | ||
|
||
Product p1 = new DerivedProduct |
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.
Could we stick with using var for consistency ?
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.
See previous comment.
@@ -1584,6 +1720,22 @@ public IQueryable<Customer> Get() | |||
return _customers.AsQueryable(); | |||
} | |||
} | |||
|
|||
public class ProductsForTypeCastController : ODataController |
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.
Could we document these public classes and methods ?
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.
Here, we're in a test file, so the other classes in this file have no comments.
But if someone of the organization feels the same way, I'll make the changes.
@clemvnt Will you continue working on this PR? |
Yes. I'm waiting for a new version of Microsoft.OData.Core with the OData/odata.net#2879 fix before publishing the PR. |
I've changed the base branch to main. This PR requires the next version of Microsoft.OData.Core (8.0.2). Other than that, it's ready. |
This PR is ready. |
@clemvnt Are you still working on this PR? |
Hello,
Cast type support in group by.
This PR needs OData/odata.net#2879.
Issues
#1180
Description
For the following group by :
groupby((MyAddress/Fully.Qualified.Namespace.HomeAddress/HomeNO))
The response was an error :
Now, the response is :