-
Notifications
You must be signed in to change notification settings - Fork 179
Make internal SelectExpandBinder methods public #840
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
base: release-8.x
Are you sure you want to change the base?
Make internal SelectExpandBinder methods public #840
Conversation
Can you point me to any EFCore example? Thanks. |
|
@xuzhg EntityFrameworkCore has a ServiceCollection where you can add stuff to with for example However, I think you don't take it far enough. Take a look at these EntityFrameworkCore classes/interfaces:
They allow extending because the necessary methods are public. Too many methods/classes are internal in OData which makes extending it without a custom copy of the code very difficult sometimes. |
| /// For unit test only. | ||
| /// </summary> | ||
| internal SelectExpandBinder() | ||
| public SelectExpandBinder() |
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.
We don't need to make this method public since it's only used internally with some tests.
| } | ||
|
|
||
| internal Expression ProjectAsWrapper(QueryBinderContext context, Expression source, SelectExpandClause selectExpandClause, | ||
| public Expression ProjectAsWrapper(QueryBinderContext context, Expression source, SelectExpandClause selectExpandClause, |
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.
Make method virtual and add docstrings.
| // Generates the expression | ||
| // source => new Wrapper { Instance = source, Container = new PropertyContainer { ..expanded properties.. } } | ||
| internal Expression ProjectElement(QueryBinderContext context, Expression source, SelectExpandClause selectExpandClause, IEdmStructuredType structuredType, IEdmNavigationSource navigationSource) | ||
| public Expression ProjectElement(QueryBinderContext context, Expression source, SelectExpandClause selectExpandClause, IEdmStructuredType structuredType, IEdmNavigationSource navigationSource) |
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.
Make method virtual and add docstrings.
| /// <param name="autoSelectedProperties">The out auto selected properties to include at current level, could be null.</param> | ||
| /// <returns>true if the select contains dynamic property selection, false if it's not.</returns> | ||
| internal static IList<DynamicPathSegment> GetSelectExpandProperties(IEdmModel model, IEdmStructuredType structuredType, IEdmNavigationSource navigationSource, | ||
| public static IList<DynamicPathSegment> GetSelectExpandProperties(IEdmModel model, IEdmStructuredType structuredType, IEdmNavigationSource navigationSource, |
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 static and cannot be overriden. How do you plan to use it?
| /// <param name="expandedItem">The expanded navigation select item. It may contain the nested query options.</param> | ||
| /// <param name="includedProperties">The container to hold the created property.</param> | ||
| internal void BuildExpandedProperty(QueryBinderContext context, Expression source, IEdmStructuredType structuredType, | ||
| public void BuildExpandedProperty(QueryBinderContext context, Expression source, IEdmStructuredType structuredType, |
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.
Make method virtual.
| /// <param name="pathSelectItem">The selected item. It may contain the nested query options and could be null.</param> | ||
| /// <param name="includedProperties">The container to hold the created property.</param> | ||
| internal void BuildSelectedProperty(QueryBinderContext context, Expression source, IEdmStructuredType structuredType, | ||
| public void BuildSelectedProperty(QueryBinderContext context, Expression source, IEdmStructuredType structuredType, |
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.
Make method virtual.
|
@bdebaere Did you get a chance to look at the feedback from @KenitoInc? |
Because so many methods are marked internal it really makes expanding OData behavior quite a hassle. I implore you to take a look at how extensible EntityFrameworkCore is for example and to reconsider all these internal methods everywhere.