Interface SzProduct
Defines the C# interface to the Senzing product functions.
public interface SzProduct
Examples
An SzProduct
instance is typically obtained from an
SzEnvironment instance via the
GetProduct() method as follows.
For example:
// How to obtain an SzProduct instance
try
{
// obtain the SzEnvironment (varies by application)
SzEnvironment env = GetEnvironment();
// get the product from the environment
SzProduct product = env.GetProduct();
. . .
}
catch (SzException e)
{
// handle or rethrow the exception (varies by application)
LogError("Failed to get SzProduct.", e);
}
Remarks
The Senzing product functions provide information regarding the Senzing product installation and user license.
Methods
GetLicense()
Returns the currently configured license details.
string GetLicense()
Returns
- string
The JSON document describing the license details.
Examples
Usage:
// How to obtain the Senzing product license JSON
try
{
// obtain the SzEnvironment (varies by application)
SzEnvironment env = GetEnvironment();
// get the SzProduct instance
SzProduct product = env.GetProduct();
// obtain the license JSON
string license = product.GetLicense();
// do something with the returned JSON (e.g.: parse it and extract values)
JsonObject? jsonObj = JsonNode.Parse(license)?.AsObject();
string? expiration = jsonObj?["expireDate"]?.GetValue<string>();
int? recordLimit = jsonObj?["recordLimit"]?.GetValue<int>();
. . .
}
catch (SzException e)
{
// handle or rethrow the exception
LogError("Failed to get license information.", e);
}
Exceptions
- SzException
Thrown if a failure occurs.
GetVersion()
Returns the currently installed version details.
string GetVersion()
Returns
- string
The JSON document of version details.
Examples
Usage:
// How to obtain the Senzing product version JSON
try
{
// obtain the SzEnvironment (varies by application)
SzEnvironment env = GetEnvironment();
// get the SzProduct instance
SzProduct product = env.GetProduct();
// obtain the version JSON
String versionJson = product.GetVersion();
// do something with the returned JSON (e.g.: parse it and extract values)
JsonObject? jsonObj = JsonNode.Parse(versionJson)?.AsObject();
string? version = jsonObj?["VERSION"]?.GetValue<string>();
string? buildDate = jsonObj?["BUILD_DATE"]?.GetValue<string>();
. . .
}
catch (SzException e)
{
LogError("Failed to get version information.", e);
}
Exceptions
- SzException
Thrown if a failure occurs.