Skip to content
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

Restructure AggregationBinder #421

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

KenitoInc
Copy link
Contributor

@KenitoInc KenitoInc commented Jan 7, 2022

The main changes:

  • Wrap the required AggregationBinder properties in QueryBinderContext
  • Make the AggregationBinder implement IAggregationBinder
  • Inject AggregationBinder as an implementation of IAggregationBinder
  • Make BindSelect and BindGroupBy methods virtual.
  • Remove support for EFClassic

Make AggregationBinder public and extensible

public class AggregationBinder : QueryBinder, IAggregationBinder
{
    public virtual Expression BindSelect(TransformationNode transformationNode, QueryBinderContext context)
    {
    }

    public virtual Expression BindGroupBy(TransformationNode transformationNode, QueryBinderContext context)
    {
    }
}

@KenitoInc KenitoInc marked this pull request as ready for review February 17, 2022 09:11
@KenitoInc KenitoInc force-pushed the feature/restructure-AggregationBinder branch from ee97227 to 822bd21 Compare January 18, 2024 09:10
@gathogojr gathogojr requested a review from xuzhg February 9, 2024 09:05
/// <summary>
/// Helper class for <see cref="AggregationBinder"/>.
/// </summary>
internal class AggregationBinderHelper : QueryBinder
Copy link
Contributor

@gathogojr gathogojr Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think having an AggregationBinderHelper class that inherits from QueryBinder is good design. You can name this class AggregationBinderExtensions and convert the methods to extension methods. Or move the method to BinderExtensions class

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FlattenReferencedProperties method calls non-static methods in the QueryBinder abstract class (Which is the base class for all query binder classes e.g FilterBinder, SelectExpandBinder).

We use the method inside the ApplyBind(this IAggregationBinder binder, IQueryable source, TransformationNode transformationNode, QueryBinderContext context, out Type resultClrType) extension method which is static.

/// <summary>
/// Helper class for <see cref="AggregationBinder"/>.
/// </summary>
internal class AggregationBinderHelper : QueryBinder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably understand if the class was named AggregationBinderBase but I'd need to be convinced that inheritance is the way to go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants