8.4 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||
|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T11:53:30.528055+00:00 | zai-org/GLM-5-FP8 | 1 | ad177a41b5582582 |
DTS.Common.Storage Module Documentation
1. Purpose
This module provides data storage schema definitions, custom attributes, and exception handling for the DTS storage layer. It defines database table structures, field enumerations, and hardware prototype identifiers used across the system for data acquisition systems (DAS), digital input settings, and measurement/monitoring equipment (MME) management. The module serves as a central schema contract between the database layer and consuming application code.
2. Public Interface
NoDBAccessException
Signature: public class NoDBAccessException : Exception
Constructor:
public NoDBAccessException(Exception ex)
Wraps an existing exception to indicate a database access failure. Preserves the original exception's message and stack trace by passing it as the inner exception.
DigitalInputSettings
Signature: public class DigitalInputSettings
Defines the schema for digital input configuration storage.
| Member | Type | Description |
|---|---|---|
Table |
const string |
Value: "tblDigitalInputSetting" - the database table name |
Fields |
enum |
Enumeration of column names: SettingName, SettingMode, ScaleMultiplier, LastModified, LastModifiedBy, SensorId, UserValue1, UserValue2, UserValue3, UserTags |
DbTypeAttr
Signature: public class DbTypeAttr : Attribute
A custom attribute for annotating enum members with database type information.
| Member | Signature | Description |
|---|---|---|
DbType |
public string DbType { get; private set; } |
The database type string |
DbTypeAttr(string attr) |
internal constructor |
Creates an instance with the specified type. Internal visibility restricts instantiation to this assembly. |
GetDbType(object o) |
public static string GetDbType(object o) |
Uses reflection to retrieve the DbTypeAttr value from an object's member. Returns null if the object is null, has no members, or lacks the attribute. |
DAS
Signature: public class DAS
Defines the schema for Data Acquisition System hardware configuration.
Constants:
| Member | Value |
|---|---|
Table |
"tblDAS" |
TableDASChannels |
"tblDASChannels" |
Prototype Constants (all const string):
SLICE1_PROTOTYPE,SLICEPRO_PROTOTYPE,PROTOTYPE_POSITIONSLICE1_5PROTOTYPE,G5_VDSPROTOTYPE,G5_IPORTPROTOTYPETDASPRO_8MRack,TDASPRO_4MRack,ECM_PROTOTYPESLE_PROTOTYPE,SDB_PROTOTYPE,Slice_NanoPROTOTYPE,Slice_MicroPROTOTYPESLICEPRODIM_PROTOTYPE,SLICEPROSLD_PROTOTYPE,SLICEPROTOM_PROTOTYPESLICEPROSLT_PROTOTYPE,SLICEPROSIM_PROTOTYPE,SLICEPROSLS_PROTOTYPESLICE1_5_MicroPROTOTYPE,G5_INDUMMYPROTOTYPE,SG5_PROTOTYPETDASPRO_LabRack,SLICE6_PROTOTYPE,SLICE6DB_PROTOTYPE
Enums:
| Enum | Fields |
|---|---|
Fields |
SerialNumber, Type, MaxModules, MaxMemory, MaxSampleRate, MinSampleRate, FirmwareVersion, CalDate, ProtocolVersion, LastModified, LastModifiedBy, Version, LocalOnly, LastUsed, LastUsedBy, Connection, Channels, Position, ChannelTypes, Reprogramable, Reconfigurable, IsModule |
DASChannelFields |
HardwareId, ChannelIdx, SupportedBridges, SupportedExcitations, DASDisplayOrder, LocalOnly, SupportedDigitalInputModes, SupportedSquibFireModes, SupportedDigitalOutputModes, ModuleSerialNumber, ModuleArrayIndex |
MMETables
Signature: public class MMETables
Defines schemas for Measurement/Monitoring Equipment reference data tables.
Legacy Field Name Constants:
| Constant | Comment |
|---|---|
MyType |
Exported in versions up to 1.3.496; replaced by "CustomChannelType" |
CustomChannelType |
Exported in versions 1.3.498 - 1.3.515; replaced by "TYPE" |
Id |
Exported in versions up to 1.3.515; replaced by "ID" |
Table Constants and Associated Enums:
| Table Constant | Enum | Notable Fields |
|---|---|---|
MMEPossibleChannelsTable ("tblMMEPossibleChannels") |
MMEPossibleChannelsFields |
Fields decorated with [CustomChannelFieldSize(n)] attribute: TEST_OBJECT, POSITION, TRANS_MAIN_LOC, FINE_LOC_1/2/3, PHYSICAL_DIMENSION, DIRECTION, DEFAULT_FILTER_CLASS, TEXT_L1/L2, REMARKS, SORTKEY, PICTURE_SHORTNAME, LAST_CHANGE, LAST_CHANGE_TEXT, HISTORY |
MMEDirectionsTable ("tblMMEDirections") |
MMEDirectionsFields |
s_GUID, DIRECTION, TEXT_L1/L2, VERSION, DATE, REMARKS, EXPIRED, SORTKEY, LAST_CHANGE, LAST_CHANGE_TEXT, HISTORY |
MMEFilterClassesTable ("tblMMEFilterClasses") |
MMEFilterClassesFields |
s_GUID, FILTER_CLASS, standard metadata fields |
MMEFineLocations1Table/2Table/3Table |
MMEFineLocations1Fields/2Fields/3Fields |
s_GUID, FINE_LOC_1/2/3, standard metadata fields |
MMEPhysicalDimensions ("tblMMEPhysicalDimensions") |
MMEPhysicalDimensionFields |
s_GUID, PHYSICAL_DIMENSION, DEFAULT_UNIT, dimension exponents (LENGTH_EXP, TIME_EXP, MASS_EXP, ELECTRIC_CURRENT_EXP, TEMPERATURE_EXP, LUMINOUS_INTENSITY_EXP, AMOUNT_OFSUBSTANCE_EXP) |
MMEPositionsTable ("tblMMEPositions") |
MMEPositionsFields |
s_GUID, POSITION, standard metadata fields |
MMETestObjectsTable ("tblMMETestObjects") |
MMETestObjectsFields |
s_GUID, TEST_OBJECT, standard metadata fields |
MMEMainLocationTable ("tblMMEMainLocations") |
MMEMainLocationsFields |
s_GUID, TYPE, TRANS_MAIN_LOC, PICTURE_SHORTNAME, standard metadata fields |
3. Invariants
- DbTypeAttr construction: The
DbTypeAttrconstructor isinternal, ensuring attributes can only be created within this assembly. - Field name stability: The
Fieldsenums use implicit integer values (0, 1, 2, ...). Adding new fields to the end of an enum preserves existing values; inserting in the middle would break compatibility. - Legacy field name compatibility: The constants
MyType,CustomChannelType, andIdinMMETablesexist to support data migration from older schema versions (pre-1.3.515). - Null safety in GetDbType: The
DbTypeAttr.GetDbType()method handles null inputs and missing attributes gracefully by returningnullrather than throwing.
4. Dependencies
This module depends on:
Systemnamespace (forException,Attribute, reflection types)System.Reflection.MemberInfo(used inDbTypeAttr.GetDbType)CustomChannelFieldSizeAttribute(referenced inMMETables.MMEPossibleChannelsFieldsbut not defined in these source files)
Consumers (inferred):
- Any module that reads/writes to the defined database tables (
tblDigitalInputSetting,tblDAS,tblDASChannels,tblMME*tables) - Hardware detection/configuration logic that references DAS prototype constants
- Database migration tooling that needs to handle legacy field names
5. Gotchas
-
Legacy field name migration: The
MMETablesclass contains three legacy field name constants (MyType,CustomChannelType,Id) with explicit version comments. Code reading from or migrating older databases must account for these renamed fields. -
Missing attribute definition:
MMETables.MMEPossibleChannelsFieldsuses[CustomChannelFieldSize(n)]attribute on multiple fields, but this attribute is not defined in the provided source files. Its location and behavior are unknown. -
Reflection performance:
DbTypeAttr.GetDbType()performs reflection on every call. In performance-critical paths, consider caching results. -
NoDBAccessException loses original type: Wrapping an exception in
NoDBAccessExceptionobscures the original exception type. Catch blocks looking for specific exception types (e.g.,SqlException) will not match. -
Typo in enum field:
MMEPhysicalDimensionFields.AMOUNT_OFSUBSTANCE_EXPappears to have a missing space in "OFSUBSTANCE" — this may be intentional (matching database column name) or a typo that is now persisted in the schema.