Datasource factory
The datasource factory creates datasource instances for the two types of datasources.
The client
variable in the following code examples refers to the IMClient
instance. When using the Web SDK, the variable name can be chosen freely, but it is also called client
at instantiation in the documentation.
Create flat datasources
To create a flat datasource, pass a unique name for the datasource to the CreateFlatDataSource
method:
IFlatDataSource flatDataSource = MClient.DataSourceFactory.CreateFlatDataSource("NewFlatDataSource");
Create hierarchical datasources
To create a hierarchical datasource, pass a unique name for the datasource to the CreateHierarchicalDataSource
method:
IHierarchicalDataSource hierachicalDataSource = MClient.DataSourceFactory.CreateHierarchicalDataSource("NewHierarchicalDataSource");
The datasource instance is not persisted. The factory only creates an object. If the datasource needs to be persisted, use the CreateAsync
on the IDataSourcesClient
.