Files
2026-04-17 14:55:32 -04:00

8.4 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common.Storage/Classes/NoDBAccessException.cs
Common/DTS.Common.Storage/Classes/DigitalInputSettings.cs
Common/DTS.Common.Storage/Classes/DbTypeAttr.cs
Common/DTS.Common.Storage/Classes/DAS.cs
Common/DTS.Common.Storage/Classes/MMETables.cs
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_POSITION
  • SLICE1_5PROTOTYPE, G5_VDSPROTOTYPE, G5_IPORTPROTOTYPE
  • TDASPRO_8MRack, TDASPRO_4MRack, ECM_PROTOTYPE
  • SLE_PROTOTYPE, SDB_PROTOTYPE, Slice_NanoPROTOTYPE, Slice_MicroPROTOTYPE
  • SLICEPRODIM_PROTOTYPE, SLICEPROSLD_PROTOTYPE, SLICEPROTOM_PROTOTYPE
  • SLICEPROSLT_PROTOTYPE, SLICEPROSIM_PROTOTYPE, SLICEPROSLS_PROTOTYPE
  • SLICE1_5_MicroPROTOTYPE, G5_INDUMMYPROTOTYPE, SG5_PROTOTYPE
  • TDASPRO_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 DbTypeAttr constructor is internal, ensuring attributes can only be created within this assembly.
  • Field name stability: The Fields enums 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, and Id in MMETables exist 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 returning null rather than throwing.

4. Dependencies

This module depends on:

  • System namespace (for Exception, Attribute, reflection types)
  • System.Reflection.MemberInfo (used in DbTypeAttr.GetDbType)
  • CustomChannelFieldSizeAttribute (referenced in MMETables.MMEPossibleChannelsFields but 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

  1. Legacy field name migration: The MMETables class 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.

  2. Missing attribute definition: MMETables.MMEPossibleChannelsFields uses [CustomChannelFieldSize(n)] attribute on multiple fields, but this attribute is not defined in the provided source files. Its location and behavior are unknown.

  3. Reflection performance: DbTypeAttr.GetDbType() performs reflection on every call. In performance-critical paths, consider caching results.

  4. NoDBAccessException loses original type: Wrapping an exception in NoDBAccessException obscures the original exception type. Catch blocks looking for specific exception types (e.g., SqlException) will not match.

  5. Typo in enum field: MMEPhysicalDimensionFields.AMOUNT_OFSUBSTANCE_EXP appears 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.