Interface SzConfig
Defines the C# interface to the Senzing config functions.
public interface SzConfig
Remarks
The Senzing config functions provide means to create, manipulate and export Senzing JSON configurations.
Methods
AddDataSource(IntPtr, string)
Adds a new data source that is identified by the specified data source code to the in-memory configuration associated with the specified configuraiton handle.
string AddDataSource(IntPtr configHandle, string dataSourceCode)
Parameters
configHandle
IntPtrThe config handle associated witht he in-memory configuration to which to add the data source.
dataSourceCode
stringThe data source code for the new data source.
Returns
- string
The JSON
string
describing the data source was added to the configuration.
Exceptions
- SzException
If a failure occurs.
CloseConfig(IntPtr)
Closes the in-memory configuration associated with the specified config handle and cleans up system resources.
void CloseConfig(IntPtr configHandle)
Parameters
configHandle
IntPtrThe configuration handle associated with the in-memory configuration to be closed.
Remarks
After calling this method, the configuration handle can no longer be used and becomes invalid.
Exceptions
- SzException
If a failure occurs.
CreateConfig()
Creates a new in-memory configuration using the default configuraiton template and returns the configuration handle for working with it.
IntPtr CreateConfig()
Returns
- IntPtr
The configuraton handle for working with the configuration that was created.
Exceptions
- SzException
If a failure occurs.
DeleteDataSource(IntPtr, string)
Deletes the data source identified by the specified data source code from the in-memory configuration associated with the specified config handle.
void DeleteDataSource(IntPtr configHandle, string dataSourceCode)
Parameters
configHandle
IntPtrThe config handle associated witht he in-memory configuration from which to delete the data source.
dataSourceCode
stringThe data source code that identifies the data source to delete from the configuration.
Exceptions
- SzException
If a failure occurs.
ExportConfig(IntPtr)
Obtains the configuration definition formatted as JSON for the in-memory configuration associated with the specified configuration handle.
string ExportConfig(IntPtr configHandle)
Parameters
configHandle
IntPtrThe configuration handle associated with the in-memory configuration to be formatted as JSON.
Returns
- string
The configuration defininition formatted as JSON.
Exceptions
- SzException
If a failure occurs.
GetDataSources(IntPtr)
Extracts the data sources from the in-memory configuration associated with the specified config handle returns the JSON text describing the data sources from the configuration.
string GetDataSources(IntPtr configHandle)
Parameters
configHandle
IntPtrThe config handle associated witht he in-memory configuration from which to obtain the data sources.
Returns
- string
The JSON
string
describing the data sources found in the configuration.
Remarks
The format of the JSON response is as follows:
{
"DATA_SOURCES": [
{
"DSRC_ID": 1,
"DSRC_CODE": "TEST"
},
{
"DSRC_ID": 2,
"DSRC_CODE": "SEARCH"
}
]
}
Exceptions
- SzException
If a failure occurs.
ImportConfig(string)
Creates a new in-memory configuration using the specified configuration definition and returns the configuration handle for working with it.
IntPtr ImportConfig(string configDefinition)
Parameters
configDefinition
stringThe definition for the Senzing configuration.
Returns
- IntPtr
The configuraton handle for working with the configuration that was created and populated with the specified definition.
Remarks
Depending upon implementation of this interface, the specified definition may allow other forms, but it is typically a JSON-formatted Senzing configuration (an example template JSON configuration ships with the Senzing product).
Exceptions
- SzException
If a failure occurs.