This is a migrated thread and some comments may be shown as answers.

AggregateFunctions on GroupDescriptor missing in Q1?

5 Answers 41 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jax
Top achievements
Rank 2
Jax asked on 17 Mar 2010, 07:54 AM
What happened to the AggregateFunctions property on GroupDescriptor?

This code doesn't compile anymore ager 2010 Q1 update:
    private IEnumerable<AggregateFunction> GetFunctionByName(string functionName) 
        { 
            var functions = 
                from descriptor in Grid.GroupDescriptors 
                from function in descriptor.AggregateFunctions 
                where function.FunctionName == functionName 
                select function; 
 
            return functions; 
        } 

5 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 17 Mar 2010, 07:59 AM
Hello Jax,

Here is an example how to do the same for Q1 2010:

private IEnumerable<AggregateFunction> GetFunctionByName(string functionName)
        {
            var functions =
                from descriptor in Grid.GroupDescriptors.OfType<GroupDescriptor>()
                from function in descriptor.AggregateFunctions
                where function.FunctionName == functionName
                select function;
 
            return functions;
        }

Regards,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jax
Top achievements
Rank 2
answered on 17 Mar 2010, 08:06 AM
Is there a reason that AggregateFunctions property is not exposed on the IGroupDescriptor interface?
 - now I have to explicitly cast every time I need access to the property.
0
Stefan Dobrev
Telerik team
answered on 17 Mar 2010, 12:56 PM
Hi Jax,

AggregateFunctions are now exposed through IAggregateFunctionsProvider interface. We have done this change in order to facility new features we are going to implement in the future. My suggestion for you is to create simple extension method that can ease your work:
internal static class GroupDescriptorExtensions
{
    public static IEnumerable<AggregateFunction> GetAggregateFunctions(this IGroupDescriptor groupDescriptor)
    {
        var aggregateFunctionsProvider = groupDescriptor as IAggregateFunctionsProvider;
        if (aggregateFunctionsProvider != null)
        {
            return aggregateFunctionsProvider.AggregateFunctions;
        }
 
        return Enumerable.Empty<AggregateFunction>();
    }
}
Actually we have this extension method in our code base and we can expose it as public in the future.

Regards,
Stefan Dobrev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jax
Top achievements
Rank 2
answered on 17 Mar 2010, 01:24 PM
I'm still not convinced as to the justification for the change.

According to the API of IGroupDescriptor, it is now not explicit that I can get access to the AggregateFunctions property.

As a user, I now have to have pre-existing knowledge that I must  cast the IGroupDescriptor (or write extension methods), in order to get access to the AggregateFunctions property.
How will new users of the control library know they need to do this to get access to the AggregateFunctions property?

Why not expose it on the IGroupDescriptor interface?
0
Stefan Dobrev
Telerik team
answered on 17 Mar 2010, 04:37 PM
Hello Jax,

We don't expose it on the IGroupDescriptor interface, because there may be group descriptors' implementation which cannot perform aggregations and it will be confusing to have a property AggregateFunctions on the IGroupDescriptor interface and not have aggregate results displayed back. If you have looked at RIA Services' GroupDescriptor or GroupDescription class that can be found in the framework they do not have the notion of the aggregation. In order to represent all these brought scenarios we have split the grouping into two interfaces IGroupDescriptor and IAggregateFunctionsProvider and our GroupDescriptor class implements them both.

All the best,
Stefan Dobrev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Jax
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Jax
Top achievements
Rank 2
Stefan Dobrev
Telerik team
Share this question
or