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

Declarative Aggregators #89

Closed
Grauenwolf opened this issue Apr 12, 2016 · 3 comments
Closed

Declarative Aggregators #89

Grauenwolf opened this issue Apr 12, 2016 · 3 comments
Labels
Aggregator Command Builders Research More research is needed before any implementation can be started.

Comments

@Grauenwolf
Copy link
Collaborator

Syntax:

ds.From( table, [filter] ).ToAggregate<TCollection, TObject>( [having filter] )

New Attributes:

  • GroupBy (index)
  • Aggregate (aggregationType)
  • Aggregate (customExpression)

Rules:

  1. If the property has both a GroupBy and an Aggregate attribute, throw an XXX exception.
  2. If the property has either a GroupBy or an Aggregate attribute, honor it.
  3. If the property is the name of a column, use it for grouping.
  4. If the property is in the format of [AggregateType][ColumnName], treat it as if it had an Aggregate attribute. Example: MaxCustomerKey would generate Max(CustomerKey) As MaxCustomerKey
@Grauenwolf Grauenwolf added Enhancement If we don't know that the enhancement is possible, use the Reseach tag Core labels Apr 12, 2016
@Grauenwolf Grauenwolf added this to the Core Phase 6 - Aggregates milestone Apr 12, 2016
@Grauenwolf Grauenwolf removed this from the Core Phase 6 - Aggregates milestone Nov 10, 2018
@Grauenwolf Grauenwolf added Aggregator Research More research is needed before any implementation can be started. and removed Enhancement If we don't know that the enhancement is possible, use the Reseach tag labels Nov 10, 2019
@Grauenwolf
Copy link
Collaborator Author

We should be able to use one attribute with three overloads.

The GroupBy overload will accept an integer to indicate the order.

@Grauenwolf Grauenwolf added this to the Tortuga Chain 4.3 milestone Jul 8, 2022
@Grauenwolf
Copy link
Collaborator Author

To activate this, use the .AsAggregate<T> method on the command builder. The T is the object that will store the aggregation.

In the future, consider adding support for a HAVING clause.

@Grauenwolf
Copy link
Collaborator Author

There will also be an .AsAggregate() method for use when the table name was inferred from the class name.

Grauenwolf added a commit that referenced this issue Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Aggregator Command Builders Research More research is needed before any implementation can be started.
Projects
None yet
Development

No branches or pull requests

1 participant