By annotating your types and members by attributes, you provide information to the live mapping system about the correspondences between the source OPC system and the target .NET objects.
For example, using the combination of DANode and DAItem attributes on a property of your object, you denote that the property corresponds to a node in OPC-DA address space, specify the name of that node (if different from property name), and mark the node as OPC item, i.e. capable of reading, writing or subscriptions. Using other attributes, you can also specify parameters for these mapping operations (such as the requested update rate). In OPC-UA, you would use a similar combination of UANode and UAData attributes.
Attributes in .NET are classes that, by convention, are named so that they end in the word “Attribute”. Some languages, such as C#, allow you to omit the final Attribute word, when the attribute is specified. For example, in C#, you can write [DAItem] instead of [DAItemAttribute]. In this document, we will mostly use the “shortened” named of attribute classes. Remember that in some languages, you may have to use the full name of the attribute class, and therefore append the word “Attribute” to the attribute name listed here.
The following table shows the Live Mapping attributes common for OPC Classic and OPC-UA, and the type of elements they can be applied to.
Attribute | Purpose | on Class or Struct | on Property, Method, or Field | on Event |
MappingTag | Member mapping | ✔ | ✔ | |
MetaMember | Member mapping | ✔ |
The following table shows the attributes available for OPC Classic, and the type of elements they can be applied to.
Attribute | Purpose | on Class or Struct | on Property, Method, or Field | on Event |
DAItem | Member mapping | ✔ | ✔ | |
DAItemIdTemplate | Propagated parameter | ✔ | ||
DAMember | Member mapping | ✔ | ||
DANode | Member mapping | ✔ | ✔ | |
DAProperty | Member mapping | ✔ | ||
DARead | Propagated parameter | ✔ | ✔ | ✔ |
DASubscription | Propagated parameter | ✔ | ✔ | ✔ |
DAType | Type mapping | ✔ | ||
Server | Propagated parameter | ✔ | ✔ |
The following table shows the attributes available for OPC Unified Architecture, and the type of elements they can be applied to.
Attribute | Purpose | on Class or Struct | on Property, Method, or Field | on Event |
UAData | Member mapping | ✔ | ✔ | |
UADataChangeFilter | Propagated parameter | ✔ | ✔ | ✔ |
UAEndpoint | Propagated parameter | ✔ | ✔ | |
UAMember | Member mapping | ✔ | ||
UAMonitoring | Propagated parameter | ✔ | ✔ | ✔ |
UANamespace | Propagated parameter | ✔ | ||
UANode | Member mapping | ✔ | ✔ | |
UANodeIdTemplate | Propagated parameter | ✔ | ||
UARead | Propagated parameter | ✔ | ✔ | ✔ |
UASubscription | Propagated parameter | ✔ | ✔ | ✔ |
UAType | Type mapping | ✔ |
The meaning of these attributes will be explained in subsequent chapters, and can be found in the reference documentation as well.