6.3 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T02:23:21.443229+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | a5e5bc31a5802f38 |
Graphs
Documentation: IGraph Interface
1. Purpose
The IGraph interface defines the contract for a graph entity that aggregates and manages a collection of IGroupChannel instances, along with associated display and persistence metadata. It extends IGraphRecord to combine database-backed metadata (e.g., name, axis limits, thresholds) with runtime graph composition logic (adding/removing channels, XML serialization/deserialization). This module serves as the core abstraction for graph configuration in the system—enabling programmatic manipulation of channel groupings and persistence of graph state to/from XML and database records.
2. Public Interface
IGraph Interface (inherits IGraphRecord)
-
void AddChannel(IGroupChannel groupChannel)
Adds the specifiedIGroupChannelto the graph’s internal collection of channels. Must be called before serialization to ensure the channel is included inChannelsString. -
void RemoveChannel(IGroupChannel groupChannel)
Removes the specifiedIGroupChannelfrom the graph’s internal collection of channels. Must be followed byUpdateChannelAndThresholdStrings()to persist the change toChannelsString. -
void ReadXML(System.Xml.XmlElement root, IReadOnlyDictionary<long, IGroupChannel> channelLookup)
Deserializes graph state from an XML element (root). UseschannelLookupto resolve channel references by ID (keyed bylong). Populates the graph’s channels and metadata (e.g., axis limits, thresholds) from XML. Note: Does not automatically callUpdateChannelAndThresholdStrings()—callers must do so explicitly if needed. -
void WriteXML(ref System.Xml.XmlWriter writer)
Serializes the graph’s state (including channels and thresholds) to XML using the providedXmlWriter. Relies on the current values ofChannelsStringandThresholdsString, which must be up-to-date (e.g., viaUpdateChannelAndThresholdStrings()). -
void UpdateChannelAndThresholdStrings()
Synchronizes theChannelsStringandThresholdsStringproperties with the current in-memory state ofGroupChannelsandThresholds. This method must be invoked beforeWriteXML()or any database persistence to ensure consistency.
IGraphRecord Interface (inherited members)
| Member | Type | Description |
|---|---|---|
GraphId |
int |
Database primary key for the graph record. |
TestSetupId |
int |
Foreign key linking the graph to a specific test setup. |
GraphName |
string |
Human-readable name (max 50 chars). |
GraphDescription |
string |
Human-readable description (max 50 chars). |
ChannelsString |
string |
Serialized list of channel identifiers (max 2048 chars). |
UseDomainMin, DomainMin |
bool, double |
Controls whether the domain (X) axis minimum is enforced. |
UseDomainMax, DomainMax |
bool, double |
Controls whether the domain (X) axis maximum is enforced. |
UseRangeMin, RangeMin |
bool, double |
Controls whether the range (Y) axis minimum is enforced. |
UseRangeMax, RangeMax |
bool, double |
Controls whether the range (Y) axis maximum is enforced. |
ThresholdsString |
string |
Serialized list of threshold definitions (max 2048 chars). |
LocalOnly |
bool |
Deprecated flag indicating whether the record is local-only (not synced to central DB). |
Note
:
IGraphRecorddoes not exposeGroupChannelsorThresholdsas properties—these are inferred to be internal to implementations ofIGraph. TheChannelsStringandThresholdsStringare the persisted representations.
3. Invariants
ChannelsStringandThresholdsStringmust be kept in sync with the in-memory channel/threshold state viaUpdateChannelAndThresholdStrings()before persistence (e.g.,WriteXML, DB save).GraphNameandGraphDescriptionare constrained to ≤ 50 characters (via[MaxLength(50)]).ChannelsStringandThresholdsStringare constrained to ≤ 2048 characters (via[MaxLength(2048)]).- Axis limits (
DomainMin,DomainMax, etc.) are only semantically valid when their correspondingUse*flag istrue. LocalOnlyis deprecated and should be ignored in new logic.
4. Dependencies
-
Depends on:
DTS.Common.Interface.Channels.IGroupChannel(for channel management).System.Collections.Generic.IReadOnlyDictionary<long, IGroupChannel>(for XML deserialization channel resolution).System.Xml.XmlElement,System.Xml.XmlWriter(for XML I/O).System.ComponentModel.DataAnnotations(for metadata annotations like[MaxLength]).
-
Depended on by:
- Likely consumed by UI layers (graph rendering), persistence services (DB/XML I/O), and test setup configuration modules (given
TestSetupId). - Implementations (not shown) would be concrete graph types (e.g.,
Graph,TimeSeriesGraph).
- Likely consumed by UI layers (graph rendering), persistence services (DB/XML I/O), and test setup configuration modules (given
5. Gotchas
- Critical:
ReadXMLdoes not automatically callUpdateChannelAndThresholdStrings()—implementations or callers must ensure strings are updated post-deserialization if persistence is required. - Critical:
AddChannel/RemoveChannelmodify internal state but do not updateChannelsString;UpdateChannelAndThresholdStrings()must be called explicitly afterward. - Ambiguity: The interface does not expose
GroupChannelsorThresholdsas properties—only their serialized string forms (ChannelsString,ThresholdsString). This implies implementations manage these collections internally, but the exact structure (e.g.,List<IGroupChannel>,HashSet<IGroupChannel>) is unknown. - Deprecated Flag:
LocalOnlyis marked as deprecated but remains part of the interface—avoid using it in new code. - String Length Limits:
ChannelsStringandThresholdsStringare capped at 2048 characters; implementations must ensure serialization does not exceed this (e.g., by truncating or rejecting channels). - No Validation on Axis Values: While
Use*flags control whether min/max values are applied, the interface does not enforce logical consistency (e.g.,DomainMin < DomainMax).