Data source client
The Data source client can be used to perform CRUD operations on data sources, also called option lists.
Get data sources
A data source can be retrieved by name:
This returns an IDataSource object. However, we recommend that you downcast it to the correct data source type as follows:
This lets you change the value of the data source.
The Type property on IDataSource identifies the correct data source type at runtime.
Create data sources
To create a hierarchical data source, use the factory to create an instance and then save the instance in the data source client.
For example, you can do this for media types, so that each type of media can have multiple subvalues.
In this example, mp4 is added as a subtype of a video media type.
Update data sources
In the following example, a flat colors data source is extended with the color red:
Delete data sources
In the following example, the MediaType data source is deleted: