Performs a database calculation such as COUNT, SUM or AVG.
Namespace:
Mindscape.LightSpeed.ServiceModelAssembly: Mindscape.LightSpeed.ServiceModel (in Mindscape.LightSpeed.ServiceModel.dll)
Version: 4.0.0.0 (4.0.0.0)
Syntax
C# |
---|
public Object Calculate( string calculation, string attribute, Query query ) |
Visual Basic (Declaration) |
---|
Public Function Calculate ( _ calculation As String, _ attribute As String, _ query As Query _ ) As Object |
Parameters
- calculation
- Type: System..::.String
A SQL fragment representing the target calculation function. E.g. "SUM".
- attribute
- Type: System..::.String
The target attribute.
- query
- Type: Mindscape.LightSpeed.Querying..::.Query
A Query.
Return Value
The result of the calculation.Implements
IUnitOfWork..::.Calculate(String, String, Query)Examples
CopyC#
Query query = new Query(typeof(Product), Entity.Attribute("OrderId") == 101); int sumOfPricesInOrder101 = (int)(unitOfWork.Calculate("SUM", "Price", query));