Expression Evaluation Time: ms / Round trip: ms
Data Aggregation in SharePoint with MatchPoint Data Providers
08. Nov
by Stefan Category:

This is the first blog post of the series Data Aggregation in SharePoint with MatchPoint Data Providers. In this series I'd like to give you an introduction into custom data providers. Before we start with a custom data provider implementation I want to give you a short introduction into the topic.

MatchPoint data providers act as a data source for the Data Grid-, the Composite- and the Chart Web Part. A data provider defines what kind of data should be displayed in these web parts. For instance the List Item Data Provider returns items located in a SharePoint list. The page Data Providers provides a complete list of out-of-the-box data providers.

In this post I'll cover the basic aspects of a custom data provider implementation.

Our custom data provider should return a configurable list of strings. Of course that's no real life scenario, but should be enough to demonstrate the basics.

To create a data provider two classes are required:

  • A configuration class that defines the settings of the data provider.
  • A data provider instance class which contains the logic required to aggregate and return the data.

The configuration class has to inherit from the type Colygon.MatchPoint.Core.DataProviders.BaseDataProvider and the instance class from the type Colygon.MatchPoint.Core.DataProviders.BaseDataProviderInstance:

public class SimpleDataProvider: BaseDataProvider {} 
public class SimpleDataProviderInstance: BaseDataProviderInstance {}

We start with the implementation of the SimpleDataProvider class. In this class we define the configuration for our data provider. Since we only want to configure a list of strings all we have to do is to define a public field of type string[]:

public class SimpleDataProvider: BaseDataProvider 
  [MemberDescriptor("Each line represents an item in the result set.")]
  public string[] List;    

The base class BaseDataProvider wants use to override the abstract method CreateInstance. We just have to return an instance of the SimpleDataProviderInstance type:

public class SimpleDataProvider: BaseDataProvider 
    [MemberDescriptor("Each line represents an item in the result set.")]
    public string[] List;

    public override BaseDataProviderInstance CreateInstance(IEnumerable<string> columnNames)
        return new SimpleDataProviderInstance(this, columnNames);

The following screenshot shows the provider configuration being edited in the MatchPoint configuration editor:

That's it for the "configuration" part. Let's move to the "logic" part. The BaseDataProviderInstance comes with an abstract method called GetInternalData. This is where you add the custom logic and return the data rows. We override this method in order to return our strings. To gain access to the configuration we store the SimpleDataProvider in a private field:

public class SimpleDataProviderInstance : BaseDataProviderInstance
    private readonly SimpleDataProvider provider;

    public SimpleDataProviderInstance(SimpleDataProvider provider, IEnumerable<string> columnNames): base(provider, columnNames)
        this.provider = provider;

    protected override IEnumerable<object> GetInternalData()
        return provider.List;

    protected override CachePolicy CachePolicy
        get { return new CachePolicy(CacheGranularity.NoCache, 0); }

That's all what is required to create a basic configurable custom data provider with MatchPoint for SharePoint.

The following screenshot shows a Data Grid Web Part using the Simple Data Provider:

In order to use this data provider the assembly containing the code has to be registered in the MatchPoint configuration file in the property "ExternalAssemblies".

In the next posts of the series I will cover more advanced scenarios for custom MatchPoint data providers such as:

  • Advanced configuration possiblities
  • Data binding
  • Caching
  • Paging
  • Support for MatchPoint conditions
  • Support for context menus in Data Grid Web Parts
  • Column name suggestion

This blog is about technical and non-technical aspects of the product MatchPoint and other SharePoint topics.

If you would like to post an article or if you have an idea for a post, please contact us.

Matthias Weibel
09.04.2018 01:12
Link is updated and works now. | Goto Post
09.04.2018 12:21
Link doesn't work. Could anyone explain what does... | Goto Post
14.03.2018 02:05
Hi Markus
We I use the config for SiteCollectionSe... | Goto Post
Reto Jeger
04.10.2017 09:15
Hello Reiner,
Thanks for pointing out the missing ... | Goto Post
29.09.2017 09:56
Hi, I downloaded the ZIP-file for MatchPoint Versi... | Goto Post