ConnectionSettings Class

Settings used to connect with the ERP Service.

Namespace: powerGate.Erp.Client
Assembly: powerGate.Erp.Client.dll

Inheritance Hierarchy

System.Object
powerGate.Erp.Client.ConnectionSettings

Syntax

1
public class ConnectionSettings

The ConnectionSettings type exposes the following members.

Constructors

Name

Description

../../../_images/method.ico ConnectionSettings()

Initializes a new instance of the ConnectionSettings class.

Properties

Type

Name

Description

../../../_images/prop.ico Uri

Service

Gets or sets the Url of the service to connect with.

../../../_images/prop.ico ICredentials

Credentials

Gets or sets the credentials to connect with the services.

../../../_images/prop.ico bool

IgnoreCertificates

Gets or sets the property whether to trust all certificates.

../../../_images/prop.ico Action<ErpClientSettings>

OnConnect

Gets or sets the Action which will be invoked before connecting to the service. More details below.

Remarks

The OnConnect-Action will be executed before connecting to the service.
In case of the CatalogService, the OnConnect will be called for each service it connects to.
Setting the Action will allow you to manipulate certain settings or even attaching to the BeforeRequest/AfterResponse handler.

Examples

The following example creates an instance of the ConnectionSettings class.

Create settings with Credentials

1
2
3
4
5
var connectionSettings = new ConnectionSettings {
	Service = new Uri("http://services.odata.org/V4/Northwind/Northwind.svc"),
	Credentials = new NetworkCredential("MyUserName", "1234"),
	IgnoreCertificates = true
};

Create settings using the OnConnect property to add a header to each request

1
2
3
4
5
6
7
8
9
var connectionSettings = new ConnectionSettings {
	Service = new Uri("http://services.odata.org/V4/Northwind/Northwind.svc"),
	OnConnect = settings => {
	        //Set a 5 seconds request timeout
	        settings.RequestTimeout = TimeSpan.FromSeconds(5);
	        //Add header to each request
	        settings.BeforeRequest = requestMessage => { requestMessage.Headers.Add("Accept", "application/json"); };
	}
};

See also

Reference