One common example is for setting default sorts on a meta-class.
A product can indicate how a meta-class should be sorted by default as follows (assuming the code is inside a builder).
The example below sets the standard sorting for a person.
The example above is already optimal, but let's examine below how we could write it using a query aspect.
Elements.Person.SetAspect( new ActionBasedQueryAspect( q => q.OrderBy("LastName").OrderBy("FirstName") ) );
The example above is trivial, but the aspect can include any query elements it wants.
The following base classes should suffice for most purposes:
ActionBasedQueryAspect: As shown above, provides a way of extending the query for a property or class. The example above is anonymous, but the aspects can also be named so that a product can add multiple aspects of the same type.
ActionBasedQueryAspectthat provides the source object when the query aspect is on a relation (e.g. if the query aspect is on the relationship from person => company, the source person is provided)