Custom Data Providers

Make Custom Data Interfaces Available in C1 CMS

C1 CMS has built-in data types (data interfaces). You can also create your own data types manually via the GUI in the Administrative console global data types or programmatically as described in "Data Types Using C#".

What if you want your custom data interfaces to be available in C1 CMS and even behave as C1 CMS's own ?

This might be the case if you have already created your data interfaces and simply want to expose them to C1 CMS or you want to integrate an external solution with its own data type system within C1 CMS.

The solution is to create a custom data provider for your data interface and hook it up into C1 CMS.

The following are the articles about creating and using custom data providers.

  • Reading SQL Server data

    A read-only data provider that exposes two tables to C1 CMS from Microsoft's demo database Northwind.

  • Data via Entity Framework

    A read-only data provider that exposes two tables to C1 CMS from Microsoft's demo database Northwind via Entity Framework.

  • Reading custom data

    A read-only data provider that exposes a custom data interface to C1 CMS.

  • A read/write data provider

    A writable data provider that exposes to C1 CMS a custom data interface based on vCard files.

General Approach

To expose a data interface to C1 CMS, you should:

  1. Implement the IDataProvider interface for a read-only data provider or IWritableDataProvider for a read/write data provider.
  2. Register the custom data provider in Composite.config

At this point you can use your exposed data types programmatically (via CMS Data API).

If you want them accessed via the GUI, you may need to take additional steps: to present them in the Admin console (via Tree Definitions) and have them edited in a user-friendly way (via dynamic forms).

The above general steps imply that you have your data types ready. Whether you create brand new data interfaces or adapt existing ones from external data sources, you need to inherit them from the IData interface (see "Data Types Using C#") and implement them in corresponding classes. This also requires implementation of the IDataId interface, too, to meet ID requirements by the exposed data system.

If your data provider requires some additional configuration settings when instantiated, you may consider to add custom attributes to the data provider configuration (Composite.config) and handle them in code.