
| Key: |
NH-1393
|
| Type: |
New Feature
|
| Status: |
Closed
|
| Resolution: |
Fixed
|
| Priority: |
Minor
|
| Assignee: |
Unassigned
|
| Reporter: |
Tuna Toksoz
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
NHibernate
Created: 19/Jul/08 06:19 AM
Updated: 17/Sep/08 08:37 PM
|
|
| Component/s: |
Core
|
| Affects Version/s: |
2.0.0.Beta2
|
| Fix Version/s: |
2.1.0.Alpha1
|
|
|
In order to provide better use of projections, we need to provide Aggregate Projections on Projections.
An example is select max(UnitPrice*Quantity) from Table t
It is trivial to do so.
|
|
Description
|
In order to provide better use of projections, we need to provide Aggregate Projections on Projections.
An example is select max(UnitPrice*Quantity) from Table t
It is trivial to do so. |
Show » |
|
It also fixes the bug in calculating the average.
For example,
if we have data
1,2,3,4 and take the average the result will be 2 because they are integers, but I believe it should be 2.5.
In order to achieve this, I've changed the constructor of AvgProjection like this
public class AvgProjection : AggregateProjection
{
public AvgProjection(String propertyName)
- : base("avg", propertyName)
+ : this(Projections.Property(propertyName))
{
}
+ public AvgProjection(IProjection projection)
+ : base("avg",Projections.Cast(NHibernateUtil.Double,projection))
+ {
+ }
I am not sure if this brings problem though.