Class DataManager
- Namespace
- Datafication.Core
- Assembly
- Datafication.Core.dll
Manages a collection of data connectors, facilitating operations like adding, removing, and fetching data asynchronously.
public class DataManager
- Inheritance
-
objectDataManager
Remarks
The DataManager is designed to interact with multiple data sources using the DataConnectorAdapter abstraction. It utilizes the concept of a factory to instantiate IDataConnector instances, which can be configured according to the requirements. The manager offers functionalities to add or remove data connectors, as well as to fetch data asynchronously from them.
Constructors
DataManager(IDataConnectorFactory, IDataConnectorConfiguration)
Initializes a new instance of the DataManager class using the specified data connector factory and configuration.
public DataManager(IDataConnectorFactory dataConnectorFactory, IDataConnectorConfiguration configuration)
Parameters
dataConnectorFactoryIDataConnectorFactoryFactory responsible for creating instances of IDataConnector.
configurationIDataConnectorConfigurationConfiguration settings for the IDataConnector.
Methods
AddConnector(IDataConnectorFactory, IDataConnectorConfiguration)
Adds a new data connector.
public void AddConnector(IDataConnectorFactory dataConnectorFactory, IDataConnectorConfiguration configuration)
Parameters
dataConnectorFactoryIDataConnectorFactoryFactory responsible for creating instances of IDataConnector.
configurationIDataConnectorConfigurationConfiguration settings for the IDataConnector.
FetchDataAsync(string)
Asynchronously fetches data using the underlying DataConnectorAdapter for the specified Id.
public Task<DataBlock> FetchDataAsync(string id)
Parameters
idstringThe Id of the data connector to fetch data from.
Returns
- Task<DataBlock>
A task that represents the asynchronous operation. The value of the TResult parameter contains an DataBlock.
RemoveConnector(string)
Removes a data connector by its Id.
public void RemoveConnector(string id)
Parameters
idstringThe Id of the data connector to remove.