Custom Data Providers
Make Custom Data Interfaces Available in Composite C1
Composite C1 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 and even behave as C1's own ?
This might be the case if you have already created your data interfaces and simply want to expose them to Composite C1 or you want to integrate an external solution with its own data type system within Composite C1.
The solution is to create a custom data provider for your data interface and hook it up into C1.
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 from Microsoft's demo database Northwind.
- Data via Entity Framework
A read-only data provider that exposes two tables to C1 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.
- A read/write data provider
A writable data provider that exposes to C1 a custom data interface based on vCard files.
To expose a data interface to C1, you should:
- Implement the IDataProvider interface for a read-only data provider or IWritableDataProvider for a read/write data provider.
- Register the custom data provider in Composite.config
At this point you can use your exposed data types programmatically (via C1 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.