Реферат: MS SQL Server 9 Yukon. Интеграция с .NET
[Serializable]
[SqlUserDefinedAggregate(Format.Native, IsInvariantToDuplicates = false, IsInvariantToNulls = true, IsInvariantToOrder = true, IsNullIfEmpty = true)]
[StructLayout(LayoutKind.Sequential)]
public class AvgGeom: INullable
{
private double _agg;
private int _count;
private bool _isNull = true;
#region User-Defined Attribute Required Methods
public void Init()
{
_agg = 0;
_count = 0;
_isNull = true;
}
public void Accumulate(SqlDouble Value)
{
if (!Value.IsNull)
{
_agg += System.Math.Log(Value.Value);
_count++;
_isNull = false;
}
}
public void Merge(AvgGeom Group)
{
if (!Group.IsNull)
{
_agg += Group._agg;