mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-18 22:55:08 +08:00
03777ecb09
- **Collections overhaul** — new/rewritten collection types (`ArrayOf`, `Collections` commits)
- **`Variant` builder/accessor** — new APIs for constructing and accessing Variants
- **`NodeId` operators made explicit** — breaking change for implicit conversions
- **Version bumped to 1.6** with preview build support
- **NumericRange** uses Variant
- **object** type accessors and general usage removed.
### 🏗️ Infrastructure
- Build config updated; `.NET 10` targeting
- InternalsVisibleTo moved to `.csproj`
- Pipeline/CI adjustments
4.8 KiB
4.8 KiB
CoreNodeManager vs CustomNodeManager2
This document outlines the key differences in behavior and implementation between CoreNodeManager and CustomNodeManager2 within the OPC UA .NET Standard Stack.
CoreNodeManager is typically used for managing the internal nodes of the Server (Namespace 0) or simple static node sets. CustomNodeManager2 is designed as a base class for developers implementing custom node managers with specific business logic, dynamic behavior, or backing stores.
1. Storage & Data Structures
| Feature | CoreNodeManager | CustomNodeManager2 |
|---|---|---|
| Node Storage | Uses a NodeTable (m_nodes) internally. |
Uses a NodeIdDictionary<NodeState> (PredefinedNodes). |
| Node Type | Manages ILocalNode interface objects. |
Manages NodeState objects (and subclasses). |
| Handle Type | GetManagerHandle returns the ILocalNode instance directly. |
GetManagerHandle returns a NodeHandle wrapper containing the NodeState and validation status. |
| Locking | Uses DataLock (object). |
Uses Lock (object). |
| Namespace | Typically manages dynamic nodes in specific indexes or internal server nodes. | Designed to manage specific namespaces passed in the constructor. Uses IsNodeIdInNamespace checks. |
2. Extensibility
| Feature | CoreNodeManager | CustomNodeManager2 |
|---|---|---|
| Design Intent | Sealed-like behavior. Not primarily designed for inheritance or overriding behavior. | Highly extensible. Most methods (Read, Write, Browse, Call) are virtual to allow custom overrides. |
| Node Factory | Does not implement INodeIdFactory. |
Implements INodeIdFactory to generate new NodeIds for the system context. |
| Address Space | CreateAddressSpace is often empty (ImportNodes is used instead). |
CreateAddressSpace invokes LoadPredefinedNodes to load nodes from resources/assemblies. |
3. Operational Behavior
Reading & Writing
- CoreNodeManager:
- Read: Directly invokes
ILocalNode.Read. - Write: Performs basic type checking (expected data type/value rank) and invokes
ILocalNode.Write.
- Read: Directly invokes
- CustomNodeManager2:
- Read: Validates the node handle, supports operation caching, and invokes
NodeState.ReadAttribute. Handles timestamp synchronization (e.g., matching ServerTimestamp to SourceTimestamp for Value attributes). - Write:
- Performs Range Checks for
AnalogItemState(InstrumentRange). - Generates Audit Events (
Server.ReportAuditWriteUpdateEvent). - Detects Semantic Changes (e.g., changes to
EURange,EnumStrings) and updates monitored items accordingly.
- Performs Range Checks for
- Read: Validates the node handle, supports operation caching, and invokes
Method Calls
- CoreNodeManager:
- Browse: Iterates over references stored in
ILocalNode. Basic masking and filtering. - Translate: Basic search through internal references.
- Browse: Iterates over references stored in
- CustomNodeManager2:
- Browse: Uses
NodeState.CreateBrowser. Explicitly validatesPermissionType.Browse. Supports Views (IsNodeInView). - Translate: Uses
CreateBrowserto navigate path. Supports resolving targets in other node managers viaunresolvedTargetIds.
- Browse: Uses
4. Monitoring & Subscriptions
| Feature | CoreNodeManager | CustomNodeManager2 |
|---|---|---|
| Manager | Uses SamplingGroupManager directly. |
Uses IMonitoredItemManager abstraction (defaults to SamplingGroupMonitoredItemManager or MonitoredNodeMonitoredItemManager). |
| Filter Validation | Validates DataChangeFilter specifically (deadband, EU Range). |
Delegates validation to ValidateMonitoringFilter, supports AggregateFilter (if supported by server) and DataChangeFilter. |
| Events | Basic event subscription support (SubscribeToEvents checks EventNotifier bit). |
Full Event Support: - Manages RootNotifiers. - Propagates events via SubscribeToAllEvents. - Implements ConditionRefresh. - Validates PermissionType.ReceiveEvents. |
5. History
- CoreNodeManager:
HistoryRead/HistoryUpdate: Iterates nodes and returnsBadNotReadable/BadNotWritable(orBadHistoryOperationUnsupportedimplicit). No infrastructure for history.
- CustomNodeManager2:
- Provides scaffold methods (
HistoryReadRawModified,HistoryReadProcessed,HistoryUpdateData, etc.). - Checks
AccessLevels.HistoryRead/WriteandEventNotifier.HistoryRead/Write. - Default implementation returns
BadHistoryOperationUnsupported, but is structured for easy overriding in derived classes.
- Provides scaffold methods (
6. Security
- CoreNodeManager:
- Checks
AccessLevel,UserAccessLevel,WriteMaskinWrite. - Loads Role Permissions into metadata.
- Checks
- CustomNodeManager2:
- Explicitly calls
MasterNodeManager.ValidateRolePermissionsduringBrowse,Call, and Event processing. - Reads and caches validation attributes (
AccessRestrictions,RolePermissions) for optimized access.
- Explicitly calls