QuickOPC User's Guide and Reference
ConfigurationPartCollection Class
Members  Example 



OpcLabs.BaseLib Assembly > OpcLabs.BaseLib.Configuration Namespace : ConfigurationPartCollection Class
A collection of configuration parts, keyed by their type names.
Syntax
'Declaration
 
<CLSCompliantAttribute(True)>
<ComDefaultInterfaceAttribute(OpcLabs.BaseLib.Configuration.ComTypes._ConfigurationPartCollection)>
<ComVisibleAttribute(True)>
<EditorParameterAttribute(OpcLabs.BaseLib.Design.CollectionEditorParameters, 
   "AttemptToClone", 
   True)>
<GuidAttribute("78173FD0-5146-498B-A111-A14521BEEEC3")>
<TypeConverterAttribute(System.ComponentModel.CollectionConverter)>
<DefaultMemberAttribute("Item")>
<DebuggerTypeProxyAttribute(System.Collections.Generic.Mscorlib_KeyedCollectionDebugView`2)>
<DebuggerDisplayAttribute("Count = {Count}")>
<SerializableAttribute()>
Public Class ConfigurationPartCollection 
   Inherits OpcLabs.BaseLib.Collections.ObjectModel.KeyedCollection2(Of String,Object)
   Implements OpcLabs.BaseLib.Configuration.ComTypes._ConfigurationPartCollection, System.Collections.Generic.ICollection(Of Object), System.Collections.Generic.IEnumerable(Of Object), System.Collections.Generic.IList(Of Object), System.Collections.Generic.IReadOnlyCollection(Of Object), System.Collections.Generic.IReadOnlyList(Of Object), System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ICloneable, System.Xml.Serialization.IXmlSerializable 
'Usage
 
Dim instance As ConfigurationPartCollection
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.BaseLib.Configuration.ComTypes._ConfigurationPartCollection)]
[ComVisible(true)]
[EditorParameter(OpcLabs.BaseLib.Design.CollectionEditorParameters, 
   "AttemptToClone", 
   true)]
[Guid("78173FD0-5146-498B-A111-A14521BEEEC3")]
[TypeConverter(System.ComponentModel.CollectionConverter)]
[DefaultMember("Item")]
[DebuggerTypeProxy(System.Collections.Generic.Mscorlib_KeyedCollectionDebugView`2)]
[DebuggerDisplay("Count = {Count}")]
[Serializable()]
public class ConfigurationPartCollection : OpcLabs.BaseLib.Collections.ObjectModel.KeyedCollection2<string,object>, OpcLabs.BaseLib.Configuration.ComTypes._ConfigurationPartCollection, System.Collections.Generic.ICollection<object>, System.Collections.Generic.IEnumerable<object>, System.Collections.Generic.IList<object>, System.Collections.Generic.IReadOnlyCollection<object>, System.Collections.Generic.IReadOnlyList<object>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ICloneable, System.Xml.Serialization.IXmlSerializable  
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.BaseLib.Configuration.ComTypes._ConfigurationPartCollection)]
[ComVisible(true)]
[EditorParameter(OpcLabs.BaseLib.Design.CollectionEditorParameters, 
   "AttemptToClone", 
   true)]
[Guid("78173FD0-5146-498B-A111-A14521BEEEC3")]
[TypeConverter(System.ComponentModel.CollectionConverter)]
[DefaultMember("Item")]
[DebuggerTypeProxy(System.Collections.Generic.Mscorlib_KeyedCollectionDebugView`2)]
[DebuggerDisplay("Count = {Count}")]
[Serializable()]
public ref class ConfigurationPartCollection : public OpcLabs.BaseLib.Collections.ObjectModel.KeyedCollection2<String,Object>, OpcLabs.BaseLib.Configuration.ComTypes._ConfigurationPartCollection, System.Collections.Generic.ICollection<Object>, System.Collections.Generic.IEnumerable<Object>, System.Collections.Generic.IList<Object>, System.Collections.Generic.IReadOnlyCollection<Object>, System.Collections.Generic.IReadOnlyList<Object>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ICloneable, System.Xml.Serialization.IXmlSerializable  
Example
// Shows how to configure the OPC UA Complex Data plug-in to use a shared data type model provider.

using System;
using System.Diagnostics;
using OpcLabs.EasyOpc.UA;
using OpcLabs.EasyOpc.UA.OperationModel;
using OpcLabs.EasyOpc.UA.Plugins.ComplexData;

namespace UADocExamples.ComplexData._UAComplexDataPluginParameters
{
    class IsolatedDataTypeModelProvider
    {
        public static void Main1()
        {
            // Define which server and node we will work with.
            UAEndpointDescriptor endpointDescriptor =
                "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
            // or "http://opcua.demo-this.com:51211/UA/SampleServer" (not in .NET Standard)
            // or "https://opcua.demo-this.com:51212/UA/SampleServer/"
            UANodeDescriptor nodeDescriptor =
                "nsu=http://test.org/UA/Data/;i=10239"; // [ObjectsFolder]/Data.Static.Scalar.StructureValue


            // We will create two instances of EasyUAClient class, and configure each of them to use the shared data type
            // model provider.

            // Configure the first client object.
            var client1 = new EasyUAClient();
            UAComplexDataPluginParameters complexDataPluginParameters1 =
                client1.InstanceParameters.PluginConfigurations.Find<UAComplexDataPluginParameters>();
            Debug.Assert(complexDataPluginParameters1 != null);
            complexDataPluginParameters1.IsolatedDataTypeModelProvider = false;

            // Configure the second client object.
            var client2 = new EasyUAClient();
            UAComplexDataPluginParameters complexDataPluginParameters2 =
                client2.InstanceParameters.PluginConfigurations.Find<UAComplexDataPluginParameters>();
            Debug.Assert(complexDataPluginParameters2 != null);
            complexDataPluginParameters2.IsolatedDataTypeModelProvider = false;


            // We will now read the same complex data node using the two client objects.
            //
            // There is no noticeable difference in the results from the default state in which the client objects are
            // set to use per-instance data type model provider. But, with the shared data type model provider, the metadata
            // obtained during the read on the first client object and cached inside the data type model provider are reused
            // during the read on the second client object, making this and the subsequent operations more efficient.

            // Read the complex data node using the first client.
            object value1;
            try
            {
                value1 = client1.ReadValue(endpointDescriptor, nodeDescriptor);
            }
            catch (UAException uaException)
            {
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException().Message);
                return;
            }
            Console.WriteLine(value1);

            // Read the complex data node using the second client.
            object value2;
            try
            {
                value2 = client2.ReadValue(endpointDescriptor, nodeDescriptor);
            }
            catch (UAException uaException)
            {
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException().Message);
                return;
            }
            Console.WriteLine(value2);
        }
    }
}
// Shows how to configure the OPC UA Complex Data plug-in to use a shared data type model provider.

class procedure IsolatedDataTypeModelProvider.Main;
var
  Client1, Client2: _EasyUAClient;
  ComplexDataPluginParameters1, ComplexDataPluginParameters2: OpcLabs_EasyOpcUA_TLB._UAComplexDataPluginParameters;
  EndpointDescriptor: string;
  NodeDescriptor: string;
  Value1, Value2: OleVariant;
begin
  // Define which server and node we will work with.
  EndpointDescriptor :=
    'http://opcua.demo-this.com:51211/UA/SampleServer';
  //or 'https://opcua.demo-this.com:51212/UA/SampleServer/';
  //or 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';
  NodeDescriptor := 'nsu=http://test.org/UA/Data/;i=10239';  // [ObjectsFolder]/Data.Static.Scalar.StructureValue

  // We will create two instances of EasyUAClient class, and configure each of them to use the shared data type
  // model provider.

  // Configure the first client object.
  Client1 := CoEasyUAClient.Create;
  ComplexDataPluginParameters1 := IUnknown(Client1.InstanceParameters.PluginConfigurations.Find('OpcLabs.EasyOpc.UA.Plugins.ComplexData.UAComplexDataPluginParameters')) as OpcLabs_EasyOpcUA_TLB._UAComplexDataPluginParameters;
  ComplexDataPluginParameters1.IsolatedDataTypeModelProvider := false;

  // Configure the second client object.
  Client2 := CoEasyUAClient.Create;
  ComplexDataPluginParameters2 := IUnknown(Client2.InstanceParameters.PluginConfigurations.Find('OpcLabs.EasyOpc.UA.Plugins.ComplexData.UAComplexDataPluginParameters')) as OpcLabs_EasyOpcUA_TLB._UAComplexDataPluginParameters;
  ComplexDataPluginParameters2.IsolatedDataTypeModelProvider := false;

  // We will now read the same complex data node using the two client objects.
  //
  // There is no noticeable difference in the results from the default state in which the client objects are
  // set to use per-instance data type model provider. But, with the shared data type model provider, the metadata
  // obtained during the read on the first client object and cached inside the data type model provider are reused
  // during the read on the second client object, making this and the subsequent operations more efficient.

  // Read the complex data node using the first client.
  try
    Value1 := Client1.ReadValue(EndpointDescriptor, NodeDescriptor);
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;
  WriteLn(Value1);

  // Read the complex data node using the second client.
  try
    Value2 := Client2.ReadValue(EndpointDescriptor, NodeDescriptor);
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;
  WriteLn(Value2);

end;
' Shows how to configure the OPC UA Complex Data plug-in to use a shared data type model provider.

Imports System
Imports OpcLabs.EasyOpc.UA
Imports OpcLabs.EasyOpc.UA.OperationModel
Imports OpcLabs.EasyOpc.UA.Plugins.ComplexData

Namespace UADocExamples.ComplexData._UAComplexDataPluginParameters

    Friend Class IsolatedDataTypeModelProvider

        Public Shared Sub Main1()

            ' Define which server we will work with.
            Dim endpointDescriptor As UAEndpointDescriptor =
                    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
            ' or "http://opcua.demo-this.com:51211/UA/SampleServer" (not in .NET Standard)
            ' or "https://opcua.demo-this.com:51212/UA/SampleServer/"

            ' Define which node we will work with.
            Dim nodeDescriptor As UANodeDescriptor = _
                "nsu=http://test.org/UA/Data/;i=10239"  ' [ObjectsFolder]/Data.Static.Scalar.StructureValue


            ' We will create two instances of EasyUAClient class, and configure each of them to use the shared data type
            ' model provider.

            ' Configure the first client object.
            Dim client1 = New EasyUAClient
            Dim complexDataPluginParameters1 As UAComplexDataPluginParameters = _
                client1.InstanceParameters.PluginConfigurations.Find(Of UAComplexDataPluginParameters)()
            Debug.Assert(complexDataPluginParameters1 IsNot Nothing)
            complexDataPluginParameters1.IsolatedDataTypeModelProvider = False

            ' Configure the second client object.
            Dim client2 = New EasyUAClient
            Dim complexDataPluginParameters2 As UAComplexDataPluginParameters = _
                client2.InstanceParameters.PluginConfigurations.Find(Of UAComplexDataPluginParameters)()
            Debug.Assert(complexDataPluginParameters2 IsNot Nothing)
            complexDataPluginParameters2.IsolatedDataTypeModelProvider = False


            ' We will now read the same complex data node using the two client objects.
            '
            ' There is no noticeable difference in the results from the default state in which the client objects are
            ' set to use per-instance data type model provider. But, with the shared data type model provider, the metadata
            ' obtained during the read on the first client object and cached inside the data type model provider are reused
            ' during the read on the second client object, making this and the subsequent operations more efficient.

            ' Read the complex data node using the first client.
            Dim value1 As Object
            Try
                value1 = client1.ReadValue(endpointDescriptor, nodeDescriptor)
            Catch uaException As UAException
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message)
                Exit Sub
            End Try
            Console.WriteLine(value1)

            ' Read the complex data node using the second client.
            Dim value2 As Object
            Try
                value2 = client2.ReadValue(endpointDescriptor, nodeDescriptor)
            Catch uaException As UAException
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message)
                Exit Sub
            End Try
            Console.WriteLine(value2)
        End Sub
    End Class
End Namespace
Rem Shows how to configure the OPC UA Complex Data plug-in to use a shared data type model provider.

Option Explicit

' Define which server and node we will work with.
Dim endpointDescriptor: endpointDescriptor = _
    "http://opcua.demo-this.com:51211/UA/SampleServer"  
'or "https://opcua.demo-this.com:51212/UA/SampleServer/"
'or "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
Dim nodeDescriptor: nodeDescriptor = _
    "nsu=http://test.org/UA/Data/;i=10239"  ' [ObjectsFolder]/Data.Static.Scalar.StructureValue


' We will create two instances of EasyUAClient class, and configure each of them to use the shared data type
' model provider.

' Configure the first client object.
Dim Client1: Set Client1 = CreateObject("OpcLabs.EasyOpc.UA.EasyUAClient")
Dim ComplexDataPluginParameters1: Set ComplexDataPluginParameters1 = Client1.InstanceParameters.PluginConfigurations.Find( _
    "OpcLabs.EasyOpc.UA.Plugins.ComplexData.UAComplexDataPluginParameters")
ComplexDataPluginParameters1.IsolatedDataTypeModelProvider = False

' Configure the second client object.
Dim Client2: Set Client2 = CreateObject("OpcLabs.EasyOpc.UA.EasyUAClient")
Dim ComplexDataPluginParameters2: Set ComplexDataPluginParameters2 = Client2.InstanceParameters.PluginConfigurations.Find( _
    "OpcLabs.EasyOpc.UA.Plugins.ComplexData.UAComplexDataPluginParameters")
ComplexDataPluginParameters2.IsolatedDataTypeModelProvider = False

' We will now read the same complex data node using the two client objects.
'
' There is no noticeable difference in the results from the default state in which the client objects are
' set to use per-instance data type model provider. But, with the shared data type model provider, the metadata
' obtained during the read on the first client object and cached inside the data type model provider are reused
' during the read on the second client object, making this and the subsequent operations more efficient.

' Read the complex data node using the first client.
On Error Resume Next
Dim Value1: Set Value1 = Client1.ReadValue(endpointDescriptor, nodeDescriptor)
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0
WScript.Echo Value1

' Read the complex data node using the second client.
On Error Resume Next
Dim Value2: Set Value2 = Client2.ReadValue(endpointDescriptor, nodeDescriptor)
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0
WScript.Echo Value2
Inheritance Hierarchy

System.Object
   System.Collections.ObjectModel.Collection<T>
      System.Collections.ObjectModel.KeyedCollection<TKey,TItem>
            OpcLabs.BaseLib.Configuration.ConfigurationPartCollection

Requirements

Target Platforms: .NET Framework: Windows 7 with SP1, Windows Server 2012; .NET Core: Linux, Microsoft Windows

See Also

Reference

ConfigurationPartCollection Members
OpcLabs.BaseLib.Configuration Namespace