1. Home
  2. Docs
  3. Congether SDK and API
  4. Congether SDK
  5. Congether SDK for .NET

Congether SDK for .NET

Install Congether SDK for .NET

The Congether SDK for .NET (.NET Standard 2.0; .NET Framework 4.6.1; .NET Core 2.0) is available as a NuGet-Package.

To install it, search for “Congether.SDK.DotNet” in your NuGet-Package Manager or type following command in your Package-Manager CLI

Install-Package Congether.SDK.DotNet

You also can find the source-code of the SDK on GitHub here. Feel free to optimize and contribute or create and share your own SDKs. For more informations on how to contribute or create SDKs for another Framework, read this docs.

Using the SDK

Using the SDK is pretty simple. Everything begins with the “CongetherClient” class. 


The CongetherClient will initialize the application, requests the Congether Manifest for your individual installation and provide all module-based tasks.

Instantiate and initialize

var client = new Congether.SDK.DotNet.CongetherClient("appIdentifier", "baseUrl", "endpoint", "secret", "optionalDeviceIdentifier", "optionalVersion");
await client.Initialize();

AppIdentifier: The identifier of your application
BaseUrl: The URL, where your Congether-Service is hosted
Endpoint: Endpoint-Token
Secret: Endpoint-Secret
DeviceIdentifier (Optional): Identifier for the Device (e.g. Hostname, Serial-Number, etc.)
Version: Application Version (if null, the AssemblyVersion will be used).

Set the Privacy-Mode

By default, the privacy-mode is “pseudonymization”. 

Using Conductor

To get your Conductor Configuration-Set, which is composed individually for each installation. You can simply use the “Conductor”-Module in your CongetherClient. This is the way on how to read a given parameter.

var configValue = await client.Conductor.GetConfigurationValue<string>("parameterKey", "defaultValue");

This will return the value of the “parameterKey” in your Configuration-Set as a string. If this parameter isn’t available or doesn’t exist, the defaultValue will be returned.

Using Tracer

To write log- or metric-events, Tracer is the module you want to use. For this case, you can use the “Tracer”-Module in your CongetherClient. 

This example shows you on how to create a simple log entry in Congether.

await client.Tracer.Log(new Congether.SDK.DotNet.EndpointLogEvent() { Identifier = "test", Content = new Congether.SDK.DotNet.VariantValue() { StringValue = "Hello world!" } });

The EndpointLogEvent contains several parameters.
Identifier: The identifier of your Tracer-Item
Content: A VariantValue, which can be contain a String, Number, Boolean or DateTime-Value
Details: A string with additional informations

The following example creates a metric entry in Congether.

await client.Tracer.Metric(new Congether.SDK.DotNet.EndpointMetricEvent() { Identifier = "metric", Value=1.234 });

The EndpointMetricEvent contains following parameters.
Identifier: The identifier of your Tracer-Item
Value: The value of your metric

Demos and Examples

You can find the demos and examples at GitHub here.

Was this article helpful to you? Yes No

How can we help?