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<TEntity>( string calculation, string attribute ) where TEntity : Entity |
Visual Basic (Declaration) |
---|
Public Function Calculate(Of TEntity As Entity) ( _ calculation As String, _ attribute As String _ ) 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.
Type Parameters
- TEntity
- The entity type.
Return Value
The result of the calculation.Implements
IUnitOfWork..::.Calculate<(Of <(TEntity>)>)(String, String)
Examples

int sumOfPrices = (int)(unitOfWork.Calculate<Product>("SUM", "Price", query));