Reference
OpcApplicationInstance<TTransport, TSecurity> Members
Represents the base class of an OPC UA application instance (e.g. a client or a server) using the transport and security settings of the types specified.
Reference
OpcApplicationInstance<TTransport, TSecurity> Members
- Type
- OpcApplicationInstance<TTransport, TSecurity>
- Namespace
- Opc.UaFx
- Assembly
- Opc.UaFx.Advanced.dll
- Package
- Opc.UaFx.Advanced v2.59.0
- Also in
- Opc.UaFx.Client
Constructors
OpcApplicationInstance
Initializes a new instance of the OpcApplicationInstance<TTransport, TSecurity> class for an application of the type specified.
protected OpcApplicationInstance(OpcApplicationType type)Protected Sub New(type As OpcApplicationType)Parameters
| Name | Type | Description |
|---|---|---|
type | Opc | The type of the application. |
Remarks
The constructor calls the abstract methods CreateTransport and CreateSecurity, so that an implementation in a derived class is called before the constructor of the derived class has run.
Properties
ApplicationName
Gets or sets the name of the application.
public virtual string ApplicationName { get; set; }Public Overridable Property ApplicationName As StringProperty value
The name of the application. The default value is "OPC Application" in case there is no entry assembly available; otherwise the value of the AssemblyTitleAttribute of the entry assembly.
Implements
Remarks
The name does not have to be unique. The value of this property is also used as the SubjectName of the application certificate whenever an application certificate is to be created/looked-up (from the application certificates store).
ApplicationUri
Gets or sets the URI of the application.
public Uri ApplicationUri { get; set; }Public Property ApplicationUri As UriProperty value
The Uri or a null reference (Nothing in Visual Basic) which uniquely identifies the application instance.
Implements
Remarks
In case there the value of this property is a null reference (Nothing in Visual Basic) the URI of the application is determined by the subject alternate name of the application certificate used. In case there an application certificate is to be automatically created (if Certificate is unspecified and AutoCreateCertificate is equals true), this value is used to define the certificates subject alternate name.
If there exists already an application certificate the value of this property is replaced with the subject alternate name in the certificate. Nevertheless another URI has been manually configured.
Certificate
Gets or sets the application certificate representing the applications identity. Changing the application certificate using this property will change the PathType of the ApplicationStore to System.
public X509Certificate2 Certificate { get; set; }Public Property Certificate As X509Certificate2Property value
An instance of the X509Certificate2 class used to identify the application instance.
Implements
CertificateStores
Gets the OpcCertificateStores instance used to maintain the different certificate stores used by the server application.
public OpcCertificateStores CertificateStores { get; }Public ReadOnly Property CertificateStores As OpcCertificateStoresProperty value
An instance of the OpcCertificateStores class used by the IOpcApplicationInstance to setup and maintain the certificate stores and their certificates used by the application.
Implements
Configuration
Gets or sets an instance of the OpcApplicationConfiguration class which is used as a low-level representation of the code/file based application configuration.
[CLSCompliant(false)]
public virtual OpcApplicationConfiguration Configuration { get; set; }<CLSCompliant(False)>
Public Overridable Property Configuration As OpcApplicationConfigurationProperty value
An instance of the OpcApplicationConfiguration class configured with the application specific setup to use. An assignment of a null reference (Nothing in Visual Basic) will lead to the creation of a new instance of the OpcApplicationConfiguration class with all defaults typically used by this type of applications.
Implements
Namespaces
Gets a read-only collection of namespaces used by the application instance.
public abstract OpcReadOnlyNamespaceCollection Namespaces { get; }Public MustOverride ReadOnly Property Namespaces As OpcReadOnlyNamespaceCollectionProperty value
OpcReadOnlyNamespaceCollection
An instance of the OpcReadOnlyNamespaceCollection class with OpcNamespace items for each 'NamespaceUri' known/used.
Implements
ProductUri
Gets or sets the URI of the product.
public Uri ProductUri { get; set; }Public Property ProductUri As UriProperty value
The Uri or a null reference (Nothing in Visual Basic) which uniquely identifies the product.
Implements
Remarks
In case there the value of this property is a null reference (Nothing in Visual Basic) the URI of the product is determined by the AssemblyCompanyAttribute and AssemblyProductAttribute used.
Security
Gets the TSecurity instance used to maintain the different security options used by the application instance.
public TSecurity Security { get; }Public ReadOnly Property Security As TSecurityProperty value
TSecurity
An instance of the TSecurity class used by the application instance to setup and maintain the different security options.
SystemContext
Gets the OpcContext which is used to store the context sensitive data and configuration used by the current application instance.
public abstract OpcContext SystemContext { get; }Public MustOverride ReadOnly Property SystemContext As OpcContextProperty value
An instance of the OpcContext class which might be at least Empty.
Implements
Transport
Gets the TTransport instance used to maintain the different transport options used by the application instance.
public TTransport Transport { get; }Public ReadOnly Property Transport As TTransportProperty value
TTransport
An instance of the TTransport class used by the application instance to setup and maintain the different transport options.
Methods
ChangeApplicationState
Changes the ApplicationState of this instance.
protected void ChangeApplicationState(OpcApplicationState newState)Protected Sub ChangeApplicationState(newState As OpcApplicationState)Parameters
| Name | Type | Description |
|---|---|---|
newState | Opc | The new Opc |
Exceptions
| Exception | Condition |
|---|---|
| Invalid | The Created is restricted as the initial state only. |
CreateSecurity
When implemented in a derived class; creates and initializes a new instance of the TSecurity which is used for the Security property.
protected abstract TSecurity CreateSecurity()Protected MustOverride Function CreateSecurity() As TSecurityReturns
TSecurity
A new instance of the type specified by TSecurity.
CreateTransport
When implemented in a derived class; creates and initializes a new instance of the TTransport which is used for the Transport property.
protected abstract TTransport CreateTransport()Protected MustOverride Function CreateTransport() As TTransportReturns
TTransport
A new instance of the type specified by TTransport.
DenyIfIsDisposed
Verifies whether the current IOpcApplicationInstance instance has been already disposed of. In the case there isDisposed is equals true an ObjectDisposedException will be thrown.
protected void DenyIfIsDisposed()Protected Sub DenyIfIsDisposed()Exceptions
| Exception | Condition |
|---|---|
| Object | The object has been disposed of. |
Dispose
| Overload | Description |
|---|---|
| Dispose() | Releases all resources used by the IOpc |
| Dispose( | Releases the unmanaged resources used by the IOpc |
Dispose()
Releases all resources used by the IOpcApplicationInstance.
public void Dispose()Public Sub Dispose()Implements
Dispose(bool)
Releases the unmanaged resources used by the IOpcApplicationInstance and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)Protected Overridable Sub Dispose(disposing As Boolean)Parameters
| Name | Type | Description |
|---|---|---|
disposing | Boolean | The value true to release both managed and unmanaged resources; otherwise the value false to release only unmanaged resources. |
IsAddressSupported
| Overload | Description |
|---|---|
| Is | Determines if the address specified is supported. |
| Is | Determines if the address specified is supported. |
IsAddressSupported(string)
Determines if the address specified is supported.
public static bool IsAddressSupported(string address)Public Shared Function IsAddressSupported(address As String) As BooleanParameters
| Name | Type | Description |
|---|---|---|
address | String | A string representing the Uri to evaluate. |
Returns
The value true if the address is supported; otherwise the value false.
Remarks
The value of the address parameter can also be a null reference (Nothing in Visual Basic) or an empty string. In both cases the result will be false.
IsAddressSupported(Uri)
Determines if the address specified is supported.
public static bool IsAddressSupported(Uri address)Public Shared Function IsAddressSupported(address As Uri) As BooleanParameters
| Name | Type | Description |
|---|---|---|
address | Uri | The Uri to evalatuate. |
Returns
The value true if the address is supported; otherwise the value false.
Remarks
The value the address parameter can be a null reference (Nothing in Visual Basic). In this case the result of the will be false.
OnCertificateRequested
Raises the CertificateRequested event of the application instance.
protected virtual void OnCertificateRequested(
OpcCertificateRequestedEventArgs e)Protected Overridable Sub OnCertificateRequested(
e As OpcCertificateRequestedEventArgs)Parameters
| Name | Type | Description |
|---|---|---|
e | Opc | The event data. |
OnCertificateValidationFailed
Raises the CertificateValidationFailed event of the application instance.
protected virtual void OnCertificateValidationFailed(
OpcCertificateValidationFailedEventArgs e)Protected Overridable Sub OnCertificateValidationFailed(
e As OpcCertificateValidationFailedEventArgs)Parameters
| Name | Type | Description |
|---|---|---|
e | Opc | The event data. |
Setup
Prepares the configuration specified before the application connects to a server or starts: updates the application certificate (see CertificateRequested) and validates the configuration.
[CLSCompliant(false)]
protected virtual void Setup(OpcApplicationConfiguration configuration)<CLSCompliant(False)>
Protected Overridable Sub Setup(configuration As OpcApplicationConfiguration)Parameters
| Name | Type | Description |
|---|---|---|
configuration | Opc | The configuration used to connect or to start. |
Exceptions
| Exception | Condition |
|---|---|
| OpcException | The application certificate could not be created or the configuration is invalid. |
Events
CertificateRequested
Occurs when the certificate of this application instance could not automatically determined using the information of this application instance. This event is when used to query the certificate to use for the application instance. Additionally use this event to determine the case that an appropriate instance certificate is missing and in case there AutoCreateCertificate of CertificateStores is equals true a new certificate is being created automatically after the event has been processed (and this may take some time).
public event OpcCertificateRequestedEventHandler CertificateRequestedPublic Event CertificateRequested As OpcCertificateRequestedEventHandlerEvent type
OpcCertificateRequestedEventHandler
Implements
Remarks
The event occurs when a server starts or a client connects, with one of the following Reason values:
- Missing, MissingPrivateKey, InvalidThumbrint, MissingApplicationUri and, for a server, InvalidDomain: the certificate cannot be used. A new certificate is created if AutoCreateCertificate is true and AlternativeCertificate is a null reference (Nothing in Visual Basic). Another certificate provided using AlternativeCertificate is used instead.
- Invalid, UseNotAllowed, Revoked, TimeInvalid, IssuerUseNotAllowed, IssuerRevoked and IssuerTimeInvalid: the certificate exists, but other applications refuse it (e.g. because it has expired). The certificate is never replaced automatically: if AlternativeCertificate is a null reference (Nothing in Visual Basic) or the original certificate, the application keeps using it; another certificate provided using AlternativeCertificate is used instead.
A certificate which is not trusted yet does not raise the event; it is added to the TrustedPeerStore.
CertificateValidationFailed
Occurs when the validation of a opponent application instance certificate does not fulfill the requirements for valid and trusted certificates.
public event OpcCertificateValidationFailedEventHandler CertificateValidationFailedPublic Event CertificateValidationFailed As OpcCertificateValidationFailedEventHandlerEvent type
OpcCertificateValidationFailedEventHandler
Implements
Remarks
This event can be used to complement the default validation of opponent application instance certificates. Using the event arguments it is possible to accept the certificate using different/custom circumstances.

