init
This commit is contained in:
131
enriched-qwen3-coder-next/Common/DTS.Common.Storage/Classes.md
Normal file
131
enriched-qwen3-coder-next/Common/DTS.Common.Storage/Classes.md
Normal file
@@ -0,0 +1,131 @@
|
||||
---
|
||||
source_files:
|
||||
- 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
|
||||
generated_at: "2026-04-16T02:10:51.158458+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ad177a41b5582582"
|
||||
---
|
||||
|
||||
# Classes
|
||||
|
||||
## Documentation: `DTS.Storage` Common Storage Types
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
This module defines core data model types and metadata used for interacting with a proprietary database in the DTS (Data Acquisition and Test System) ecosystem. It provides strongly-typed constants for table and column names, custom exception types for access control, and reflection-based utilities for mapping .NET enum values to database-specific type strings. Its role is to decouple database schema knowledge from business logic, enabling type-safe, maintainable data access across the system.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `NoDBAccessException`
|
||||
- **Signature**: `public class NoDBAccessException : Exception`
|
||||
- **Behavior**: A custom exception class wrapping another exception (`ex`) to indicate a database access denial or failure. It preserves the original exception’s message and inner exception.
|
||||
|
||||
#### `DigitalInputSettings`
|
||||
- **Fields**:
|
||||
- `public const string Table = "tblDigitalInputSetting";`
|
||||
- `public enum Fields { ... }`
|
||||
Enumerates column names for the `tblDigitalInputSetting` table:
|
||||
`SettingName`, `SettingMode`, `ScaleMultiplier`, `LastModified`, `LastModifiedBy`, `SensorId`, `UserValue1`, `UserValue2`, `UserValue3`, `UserTags`.
|
||||
|
||||
#### `DbTypeAttr`
|
||||
- **Fields**:
|
||||
- `public string DbType { get; }` – Stores the database type string.
|
||||
- **Methods**:
|
||||
- `public static string GetDbType(object o)` – Uses reflection to retrieve the `DbType` string associated with an enum *value* (via its `MemberInfo`). Returns `null` if no attribute is found.
|
||||
|
||||
#### `DAS`
|
||||
- **Fields**:
|
||||
- `public const string Table = "tblDAS";`
|
||||
- `public enum Fields { ... }`
|
||||
Enumerates columns for `tblDAS`:
|
||||
`SerialNumber`, `Type`, `MaxModules`, `MaxMemory`, `MaxSampleRate`, `MinSampleRate`, `FirmwareVersion`, `CalDate`, `ProtocolVersion`, `LastModified`, `LastModifiedBy`, `Version`, `LocalOnly`, `LastUsed`, `LastUsedBy`, `Connection`, `Channels`, `Position`, `ChannelTypes`, `Reprogramable`, `Reconfigurable`, `IsModule`.
|
||||
- `public const string TableDASChannels = "tblDASChannels";`
|
||||
- `public enum DASChannelFields { ... }`
|
||||
Enumerates columns for `tblDASChannels`:
|
||||
`HardwareId`, `ChannelIdx`, `SupportedBridges`, `SupportedExcitations`, `DASDisplayOrder`, `LocalOnly`, `SupportedDigitalInputModes`, `SupportedSquibFireModes`, `SupportedDigitalOutputModes`, `ModuleSerialNumber`, `ModuleArrayIndex`.
|
||||
- **Prototype Constants**:
|
||||
A large set of `public const string` values representing known DAS hardware prototypes (e.g., `"SLICE1 Prototype"`, `"G5 VDS Prototype"`, `"SLICE PRO Lab TOM"`). Used for identifying device types.
|
||||
|
||||
#### `MMETables`
|
||||
- **Fields**:
|
||||
- `public const string MyType = "MyType";`
|
||||
Legacy table name (used up to version 1.3.496), superseded by `CustomChannelType`.
|
||||
- `public const string CustomChannelType = "CustomChannelType";`
|
||||
Intermediate table name (versions 1.3.498–1.3.515), superseded by `"TYPE"`.
|
||||
- `public const string Id = "Id";`
|
||||
Legacy column name (up to 1.3.515), superseded by `"ID"`.
|
||||
- **Table Names & Field Enums**:
|
||||
- `MMEPossibleChannelsTable = "tblMMEPossibleChannels"`
|
||||
`MMEPossibleChannelsFields` enum with fields like `ID`, `TYPE`, `TEST_OBJECT`, `POSITION`, `PHYSICAL_DIMENSION`, `DIRECTION`, `DEFAULT_FILTER_CLASS`, `TEXT_L1`, `TEXT_L2`, `VERSION`, `DATE`, `REMARKS`, `EXPIRED`, `SORTKEY`, `PICTURE_SHORTNAME`, `LAST_CHANGE`, `LAST_CHANGE_TEXT`, `HISTORY`.
|
||||
Several fields are annotated with `[CustomChannelFieldSize(n)]` (not defined in this file—likely elsewhere).
|
||||
- `MMEDirectionsTable = "tblMMEDirections"`
|
||||
`MMEDirectionsFields` enum: `s_GUID`, `DIRECTION`, `TEXT_L1`, `TEXT_L2`, `DATE`, `VERSION`, `EXPIRED`, `REMARKS`, `LAST_CHANGE`, `LAST_CHANGE_TEXT`, `HISTORY`, `SORTKEY`.
|
||||
- `MMEFilterClassesTable = "tblMMEFilterClasses"`
|
||||
`MMEFilterClassesFields` enum: `s_GUID`, `FILTER_CLASS`, `TEXT_L1`, `TEXT_L2`, `VERSION`, `DATE`, `REMARKS`, `EXPIRED`, `SORTKEY`, `LAST_CHANGE`, `LAST_CHANGE_TEXT`, `HISTORY`.
|
||||
- `MMEFineLocations1Table`, `MMEFineLocations2Table`, `MMEFineLocations3Table`
|
||||
Corresponding enums with `s_GUID`, location field (`FINE_LOC_1`/`2`/`3`), `TEXT_L1`, `TEXT_L2`, `VERSION`, `DATE`, `REMARKS`, `EXPIRED`, `SORTKEY`, `LAST_CHANGE`, `LAST_CHANGE_TEXT`, `HISTORY`.
|
||||
- `MMEPhysicalDimensions = "tblMMEPhysicalDimensions"`
|
||||
`MMEPhysicalDimensionFields` enum includes `s_GUID`, `PHYSICAL_DIMENSION`, `TEXT_L1`, `TEXT_L2`, `DEFAULT_UNIT`, dimensional exponents (`LENGTH_EXP`, `TIME_EXP`, etc.), `VERSION`, `DATE`, `REMARKS`, `EXPIRED`, `SORTKEY`, `LAST_CHANGE`, `LAST_CHANGE_TEXT`, `HISTORY`.
|
||||
- `MMEPositionsTable = "tblMMEPositions"`
|
||||
`MMEPositionsFields` enum: `s_GUID`, `POSITION`, `TEXT_L1`, `TEXT_L2`, `VERSION`, `DATE`, `REMARKS`, `EXPIRED`, `SORTKEY`, `LAST_CHANGE`, `LAST_CHANGE_TEXT`, `HISTORY`.
|
||||
- `MMETestObjectsTable = "tblMMETestObjects"`
|
||||
`MMETestObjectsFields` enum: `s_GUID`, `TEST_OBJECT`, `TEXT_L1`, `TEXT_L2`, `VERSION`, `DATE`, `REMARKS`, `EXPIRED`, `SORTKEY`, `LAST_CHANGE`, `LAST_CHANGE_TEXT`, `HISTORY`.
|
||||
- `MMEMainLocationTable = "tblMMEMainLocations"`
|
||||
`MMEMainLocationsFields` enum: `s_GUID`, `TYPE`, `TRANS_MAIN_LOC`, `TEXT_L1`, `TEXT_L2`, `VERSION`, `DATE`, `REMARKS`, `EXPIRED`, `SORTKEY`, `PICTURE_SHORTNAME`, `LAST_CHANGE`, `LAST_CHANGE_TEXT`, `HISTORY`.
|
||||
|
||||
> **Note**: `[CustomChannelFieldSize(n)]` is referenced in `MMETables` but *not defined in the provided source files*. Its definition is unknown.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **`DbTypeAttr.GetDbType` behavior**:
|
||||
- Only inspects the *first* member info (`mi[0]`) returned by `GetType().GetMember(o.ToString())`.
|
||||
- Returns `null` if the object is `null`, no member is found, or no `DbTypeAttr` is applied to the enum value.
|
||||
- Assumes the enum value’s name matches a member name on its type (standard for `enum.ToString()`).
|
||||
- **Table/column naming**:
|
||||
- Table names are hardcoded string constants (e.g., `"tblDAS"`, `"tblMMEPossibleChannels"`).
|
||||
- Field names in enums map directly to database column names (e.g., `DAS.Fields.SerialNumber` → `"SerialNumber"`).
|
||||
- **Versioning semantics**:
|
||||
- `MyType`, `CustomChannelType`, and `Id` are explicitly marked as legacy. Their usage is version-gated in the system (not enforced in this module).
|
||||
- **Prototype constants**:
|
||||
- All prototype names are exact string literals; no normalization or canonicalization is performed in this module.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
- **Dependencies *of* this module**:
|
||||
- `System` (for `Exception`, `Attribute`, `MemberInfo`, `Reflection`).
|
||||
- No external libraries beyond .NET Framework base types.
|
||||
- **Dependencies *on* this module**:
|
||||
- Any module performing database access using these schema constants (e.g., data access layers, configuration tools, migration scripts).
|
||||
- Code that uses `DbTypeAttr` for dynamic SQL generation or type mapping.
|
||||
- Modules handling DAS device metadata (e.g., device discovery, configuration, calibration).
|
||||
- Modules managing MME (likely "Measurement Model Exchange") metadata (e.g., channel definition, test setup, reporting).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **`[CustomChannelFieldSize]` is undefined here**:
|
||||
The `MMETables` enum uses `[CustomChannelFieldSize(n)]` attributes, but this attribute type is *not defined* in the provided source. Its behavior and usage are unknown.
|
||||
- **`DbTypeAttr.GetDbType` is fragile**:
|
||||
Relies on `GetMember(o.ToString())`, which may fail or return unexpected results if enum values have custom names or if reflection is blocked (e.g., in some AOT or security contexts).
|
||||
- **Legacy table/column names are *not* handled programmatically**:
|
||||
`MyType`, `CustomChannelType`, and `Id` are documented as historical, but no runtime logic is present to select the correct name based on version. Consumers must manage version compatibility themselves.
|
||||
- **Prototype strings are magic**:
|
||||
All `PROTOTYPE` constants are raw strings. No validation or enum-based safety prevents typos or mismatches in device type identification.
|
||||
- **No validation in `NoDBAccessException`**:
|
||||
The constructor accepts any `Exception`, including `null` (though `ex.Message` would throw if `ex` is `null`). This may lead to `NullReferenceException` at construction time if misused.
|
||||
- **Case sensitivity**:
|
||||
Enum field names (e.g., `ID` vs `Id`) are used verbatim. Ensure database column names match *exactly* (case-sensitive in some DBMSs).
|
||||
@@ -0,0 +1,126 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/MMEPossibleChannels.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/DbVersions.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/Settings.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/VersionTable.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/TestObjectChannelSettings.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/Tags.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/DigitalOutputSettings.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/LabratoryDetails.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/Squib.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/CalculatedChannels.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/Users.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/LevelTriggers.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/SensorDB.cs
|
||||
- Common/DTS.Common.Storage/Classes/Abstract/TestSetups.cs
|
||||
generated_at: "2026-04-16T02:11:23.946439+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "275c64f80988749d"
|
||||
---
|
||||
|
||||
# Abstract
|
||||
|
||||
## Documentation: Storage Abstraction Layer – Table and Field Constants
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
This module provides a centralized, strongly-typed abstraction layer for database schema metadata within the DTS Storage subsystem. It defines `abstract` classes containing `const string` table names and `enum` types for field names across multiple database tables (e.g., `tblSettings`, `tblSensors`, `tblTestSetups`). These constants are used throughout the codebase to avoid hard-coded string literals in SQL queries, ORM mappings, or data access logic—ensuring consistency, reducing typos, and enabling refactoring safety. The module does *not* contain business logic, data access implementations, or validation; it is purely a metadata definition layer.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
All types are `abstract` classes with no instance members. Public members are `const` strings and `enum` declarations.
|
||||
|
||||
| Type | Member | Signature | Description |
|
||||
|------|--------|-----------|-------------|
|
||||
| `MMEPossibleChannels` | `Table` | `public const string Table = "tblMMEPossibleChannels";` | Table name for MME possible channel configurations. |
|
||||
| `DbVersions` | `DbVersionFields` | `public enum DbVersionFields { Version, Step, Date, Remarks, UserField }` | Field names for the database version tracking table (unspecified table name in source). |
|
||||
| `Settings` | `Table` | `public const string Table = "tblSettings";` | Table name for user/application settings. |
|
||||
| `Settings` | `UserFields` | `public enum UserFields { PropertyId, PropertyType, PropertyValue, UserId }` | Field names for the `tblSettings` table. |
|
||||
| `VersionTable` | `TableName` | `public const string TableName = "tblDataPRODbVersion";` | Table name for version tracking (distinct from `DbVersions` table reference). |
|
||||
| `VersionTable` | `Fields` | `public enum Fields { Version, Step, Date, Remarks, UserField }` | Field names for `tblDataPRODbVersion`. |
|
||||
| `TestObjectChannelSettings` | `TableName` | `public const string TableName = "tblTestObjectChannelSettings";` | Table name for per-test-object channel configuration. |
|
||||
| `TestObjectChannelSettings` | `Fields` | `public enum Fields { TestObjectSerial, ChannelId, Setting, SensorSerial }` | Field names for `tblTestObjectChannelSettings`. |
|
||||
| `Tags` | `Table` | `public const string Table = "tblTags";` | Table name for tag definitions. |
|
||||
| `Tags` | `TagFields` | `public enum TagFields { TagId, TagText, Obsolete }` | Field names for `tblTags`. |
|
||||
| `Tags` | `TAGASSIGNMENTS_TABLE` | `public const string TAGASSIGNMENTS_TABLE = "TagAssignments";` | Table name for tag assignments (note: no `tbl` prefix). |
|
||||
| `Tags` | `TagAssignmentFields` | `public enum TagAssignmentFields { ObjectID, ObjectType, TagID }` | Field names for `TagAssignments`. |
|
||||
| `DigitalOutputSettings` | `Table` | `public const string Table = "tblTOMDigitalChannels";` | Table name for digital output channel settings. |
|
||||
| `DigitalOutputSettings` | `Fields` | `public enum Fields { ChannelDescription, DelayMS, DurationMS, OutputMode, LimitDuration, LastModified, LastModifiedBy, Version, LocalOnly, DurationMSFloat, UserTags }` | Field names for `tblTOMDigitalChannels`. |
|
||||
| `LabratoryDetails` | `Table` | `public const string Table = "tblLabratoryDetails";` | Table name for laboratory metadata (note: typo in table name: *Labratory* vs *Laboratory*). |
|
||||
| `LabratoryDetails` | `LabratoryDetailsFields` | `public enum LabratoryDetailsFields { Name, LabratoryName, LabratoryContactName, LabratoryContactPhone, LabratoryContactFax, LabratoryContactEmail, LabratoryTestRefNumber, LabratoryProjectRefNumber, LastModified, LastModifiedBy, LocalOnly, Version }` | Field names for `tblLabratoryDetails`. |
|
||||
| `Squib` | `Table` | `public const string Table = "tblTOMSquibChannels";` | Table name for squib (explosive device) channel settings. |
|
||||
| `Squib` | `Fields` | `public enum Fields { SquibDescription, BypassCurrentFilter, BypassVoltageFilter, DelayMS, DurationMS, FireMode, ISOCode, MeasurementType, SquibOutputCurrent, SquibToleranceLow, SquibToleranceHigh, LimitDuration, ArticleId, LocalOnly, Version, LastModified, LastModifiedBy, UserValue1, UserValue2, UserValue3, UserTags }` | Field names for `tblTOMSquibChannels`. |
|
||||
| `CalculatedChannels` | `Table` | `public const string Table = "tblCalculatedChannels";` | Table name for calculated channel definitions. |
|
||||
| `CalculatedChannels` | `Fields` | `public enum Fields { Id, Operation, CalculatedChannelValueCode, InputChannelIds, CFCForInputChannels, CFCForOutput, TestSetupName, CCName }` | Field names for `tblCalculatedChannels`. <br> **Note**: Fields use `[DbTypeAttr(...)]` attributes (e.g., `Id` is `INTEGER PRIMARY KEY NOT NULL`). |
|
||||
| `Users` | `USERS_TABLE` | `public const string USERS_TABLE = "DataPROUsers";` | Table name for user accounts (no `tbl` prefix). |
|
||||
| `Users` | `UserFields` | `public enum UserFields { ID, UserName, DisplayName, Password, Role, LastModified, LastModifiedBy, LocalOnly }` | Field names for `DataPROUsers`. |
|
||||
| `Users` | `UIITEMS_TABLE` | `public const string UIITEMS_TABLE = "UIITEMS";` | Table name for UI item definitions (no `tbl` prefix). |
|
||||
| `Users` | `UIItemFields` | `public enum UIItemFields { ID, Name }` | Field names for `UIITEMS`. |
|
||||
| `Users` | `USERUISETTINGS_TABLE` | `public const string USERUISETTINGS_TABLE = "UserUIItemSettings";` | Table name for per-user UI settings (no `tbl` prefix). |
|
||||
| `Users` | `UserUIItemSettingFields` | `public enum UserUIItemSettingFields { UserId, UIItemID, Permission, Visible }` | Field names for `UserUIItemSettings`. |
|
||||
| `LevelTriggers` | `Table` | `public const string Table = "tblLevelTriggers";` | Table name for level-triggering conditions. |
|
||||
| `LevelTriggers` | `Fields` | `public enum Fields { TestSetupName, GroupSerialNumber, TestObjectChannelId, HardwareChannelId, SensorSerialNumber, GreaterThanEnabled, GreaterThanEU, LessThanEnabled, LessThanEU, InsideUpperEU, InsideLowerEU, OutsideUpperEU, OutsideLowerEU, TriggerInside, TriggerOutside }` | Field names for `tblLevelTriggers`. <br> **Note**: Fields use `[DbTypeAttr(...)]` attributes (e.g., `GreaterThanEnabled` is `BIT NOT NULL`). |
|
||||
| `SensorDB` | `SensorCalibrationTable` | `public const string SensorCalibrationTable = "tblSensorCalibrations";` | Table name for sensor calibration records. |
|
||||
| `SensorDB` | `SensorDataTable` | `public const string SensorDataTable = "tblSensors";` | Table name for sensor definitions. |
|
||||
| `SensorDB` | `SensorModelsTable` | `public const string SensorModelsTable = "tblSensorModels";` | Table name for sensor model templates. |
|
||||
| `SensorDB` | `SensorDataFields` | `public enum SensorDataFields { SerialNumber, UserSerialNumber, Model, ... }` (48 fields) | Field names for `tblSensors`. Includes metadata (e.g., `Version`, `LocalOnly`, `UserTags`, `Broken`). |
|
||||
| `SensorDB` | `SensorModelFields` | `public enum SensorModelFields { Model, Manufacturer, UserPartNumber, ... }` (32 fields) | Field names for `tblSensorModels`. |
|
||||
| `SensorDB` | `SensorCalibrationFields` | `public enum SensorCalibrationFields { SerialNumber, CalibrationDate, Username, ... }` (10 fields) | Field names for `tblSensorCalibrations`. |
|
||||
| `SensorDB` | `SensorCalibrationRecordFields` | `public enum SensorCalibrationRecordFields { Sensitivity, Poly, AtCapacity, ... }` (7 fields) | Field names for calibration records *within* `tblSensorCalibrations` (likely stored as serialized data, e.g., BLOB). |
|
||||
| `TestSetups` | `HardwareTable` | `public const string HardwareTable = "tblTestSetupHardware";` | Table for test setup–hardware associations. |
|
||||
| `TestSetups` | `HardwareFields` | `public enum HardwareFields { TestSetupName, HardwareId, AddOrRemove }` | Field names for `tblTestSetupHardware`. `AddOrRemove` uses `0=remove, 1=add`. |
|
||||
| `TestSetups` | `DASSettingsTable` | `public const string DASSettingsTable = "tblTestSetupDASSettings";` | Table name for DAQ settings (no fields enum provided). |
|
||||
| `TestSetups` | `ChannelSettingsTable` | `public const string ChannelSettingsTable = "tblTestChannelSettings";` | Table name for test channel settings. |
|
||||
| `TestSetups` | `ChannelSettingFields` | `public enum ChannelSettingFields { TestName, TestObjectName, ChannelId, Setting, SensorSerial }` | Field names for `tblTestChannelSettings`. |
|
||||
| `TestSetups` | `TestSetupsTable` | `public const string TestSetupsTable = "tblTestSetups";` | Table name for test setup definitions. |
|
||||
| `TestSetups` | `Fields` | `public enum Fields { SetupName, SetupDescription, AutomaticTestProgression, ... }` (64 fields) | Field names for `tblTestSetups`. Includes flags (`ROIDownload`, `ViewRealtime`), paths (`ExportFolder`), and behavior controls (`StrictDiagnostics`, `RequireConfirmationOnErrors`). |
|
||||
| `TestSetups` | `TestSetupObjectsTable` | `public const string TestSetupObjectsTable = "tblTestSetupObjects";` | Table for test objects assigned to a test setup. |
|
||||
| `TestSetups` | `TestSetupObjectFields` | `public enum TestSetupObjectFields { TestObjectSerialNumber, TestSetupName, TargetSampleRate, ... }` | Field names for `tblTestSetupObjects`. |
|
||||
| `TestSetups` | `TestObjectMetaDataTable` | `public const string TestObjectMetaDataTable = "tblTestSetupObjectMetaData";` | Table for test object metadata key-value pairs. |
|
||||
| `TestSetups` | `TestObjectMetaDataFields` | `public enum TestObjectMetaDataFields { TestObject, SetupName, PropName, PropValue, Optional, Version }` | Field names for `tblTestSetupObjectMetaData`. |
|
||||
| `TestSetups` | `TestObjectTemplatesTable` | `public const string TestObjectTemplatesTable = "tblTestObjectTemplates";` | Table for test object templates. |
|
||||
| `TestSetups` | `TestObjectTemplatesFields` | `public enum TestObjectTemplatesFields { TemplateName, Icon, Description, ... }` | Field names for `tblTestObjectTemplates`. Includes `CRC32`, `SysBuilt`, and `ParentTemplate`. |
|
||||
| `TestSetups` | `TestObjectsTable` | `public const string TestObjectsTable = "tblTestObjects";` | Table for test object definitions. |
|
||||
| `TestSetups` | `TestObjectsFields` | `public enum TestObjectsFields { SerialNumber, LastModifiedBy, LastModified, Template, ... }` | Field names for `tblTestObjects`. Tracks templates, embedding, and original serial numbers. |
|
||||
| `TestSetups` | `TestGraphsTable` | `public const string TestGraphsTable = "tblTestGraphs";` | Table for test graph configurations. |
|
||||
| `TestSetups` | `GraphFields` | `public enum GraphFields { GraphName, GraphDescription, TemplateName, Channels, UseDomainMin, DomainMin, ... }` | Field names for `tblTestGraphs`. Includes axis ranges and thresholds. |
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **No instance state**: All classes are `abstract` and contain only `const` and `enum` members. No runtime behavior or state is defined.
|
||||
- **Case sensitivity**: Table and field names are case-sensitive string literals (e.g., `tblSettings`, not `tblsettings`).
|
||||
- **Naming consistency**:
|
||||
- Table names use `tbl` prefix for most tables (e.g., `tblSensors`, `tblTestSetups`), but exceptions exist: `DataPROUsers`, `UIITEMS`, `UserUIItemSettings`, `TagAssignments`.
|
||||
- Enum names follow `XxxFields` or `XxxFields` pattern (e.g., `SensorDataFields`, `UserFields`).
|
||||
- **Field ordering**: Enum values are *not* explicitly assigned integer values (except `SensorDataFields.SerialNumber = 1`), so their underlying values are sequential starting from `0` (or `1` for `SerialNumber`).
|
||||
- **Type annotations**: `[DbTypeAttr(...)]` attributes (e.g., on `CalculatedChannels.Id` and `LevelTriggers` fields) are present in source but are *not* part of the runtime type system—likely custom attributes for code generation or ORM mapping. Their presence does not affect the enum/const definitions themselves.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
- **No external dependencies**: None of the files reference `using` directives or external types. All types are self-contained within the `DTS.Storage` or `Storage.Classes.Abstract` namespaces.
|
||||
- **Consumers**: This module is intended to be referenced by data access layers, migration scripts, or ORM configurations elsewhere in the codebase (e.g., to build SQL queries like `SELECT {TestSetups.Fields.SetupName} FROM {TestSetups.TestSetupsTable}`).
|
||||
- **Namespace overlap**: Two namespaces are used: `DTS.Storage` (most files) and `Storage.Classes.Abstract` (`DbVersions.cs`). This suggests possible namespace migration or legacy coexistence.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **Typo in table name**: `LabratoryDetails` class references `"tblLabratoryDetails"` (misspelled *Labratory*). This is likely intentional to match an existing database schema.
|
||||
- **Inconsistent table prefixes**: Most tables use `tbl` prefix, but `DataPROUsers`, `UIITEMS`, `UserUIItemSettings`, and `TagAssignments` do not.
|
||||
- **Enum name collisions**: `UserFields` is defined in both `Settings` and `Users` classes, but with different fields (`PropertyId` vs `ID`, `UserName`, etc.). This implies separate contexts (settings vs. user accounts).
|
||||
- **Missing table references**: `DbVersions` defines `DbVersionFields` but *no table name constant*; `VersionTable` defines `TableName` and `Fields`, but the fields are identical to `DbVersions.DbVersionFields`. This suggests potential redundancy or historical duplication.
|
||||
- **`AddOrRemove` semantics**: In `HardwareFields`, `AddOrRemove = 0` means *remove*, `= 1` means *add*. This inverse naming may be counterintuitive.
|
||||
- **`SensorCalibrationRecordFields`**: This enum is defined but no corresponding table name constant is provided. Given the context, calibration records are likely stored as a serialized blob in `tblSensorCalibrations.CalibrationRecords`, not as a separate table.
|
||||
- **`CalculatedChannels.InputChannelIds`**: Typed as `BLOB` (likely storing a serialized list of channel IDs). Consumers must handle serialization/deserialization.
|
||||
- **`CalculatedChannels.CFCForInputChannels` / `CFCForOutput`**: Field names suggest "Calculated Function Chain" (CFC) logic, but no documentation of the format or execution engine is provided here.
|
||||
|
||||
None identified beyond those listed.
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Storage/Classes/Static/CustomChannelFieldSizeAttribute.cs
|
||||
generated_at: "2026-04-16T02:11:01.276588+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "96c94c51da2a1b2d"
|
||||
---
|
||||
|
||||
# Static
|
||||
|
||||
## 1. Purpose
|
||||
This module provides a mechanism to associate custom, non-default field sizes with enum values representing channel fields in the `MMETables.MMEPossibleChannelsFields` enumeration. It enables runtime retrieval of field-specific size metadata via a custom attribute (`CustomChannelFieldSizeAttribute`) and extension methods, supporting scenarios where the default size inference (e.g., based on underlying type or convention) is insufficient or incorrect.
|
||||
|
||||
## 2. Public Interface
|
||||
- **`CustomChannelFieldSizeAttribute(int size)`**
|
||||
*Constructor.* Creates an attribute instance with the specified field size. `size` must be non-negative (enforced by caller; no validation in constructor).
|
||||
- **`int Size { get; }`**
|
||||
*Property.* Returns the field size stored in the attribute. Read-only after construction.
|
||||
- **`int GetFieldSize(MMETables.MMEPossibleChannelsFields field)`**
|
||||
*Extension method.* Retrieves the field size for a given `MMEPossibleChannelsFields` enum value by inspecting its `CustomChannelFieldSizeAttribute`. Throws `NullReferenceException` if the attribute is not applied to the enum value (since `.Size` is accessed on a `null` reference returned by `GetAttribute<>()`).
|
||||
- **`TAttribute GetAttribute<TAttribute>(this Enum value)`**
|
||||
*Extension method.* Returns the first (and expected only) custom attribute of type `TAttribute` applied to the enum value, or `null` if none exists. Uses reflection to inspect the enum field’s attributes.
|
||||
|
||||
## 3. Invariants
|
||||
- `CustomChannelFieldSizeAttribute` is only intended for use on `MMETables.MMEPossibleChannelsFields` enum members.
|
||||
- The `Size` property must be set at construction and remains immutable thereafter.
|
||||
- `GetFieldSize` assumes exactly one `CustomChannelFieldSizeAttribute` per enum member; behavior is undefined if multiple attributes are applied (though `SingleOrDefault()` would return the first if duplicates exist, which is invalid per attribute semantics).
|
||||
- `GetAttribute<TAttribute>` returns `null` if no attribute of type `TAttribute` is present on the enum value.
|
||||
|
||||
## 4. Dependencies
|
||||
- **Internal dependencies:**
|
||||
- `MMETables.MMEPossibleChannelsFields` enum (from `MMETables` namespace—external to this file but referenced in `GetFieldSize`).
|
||||
- Standard .NET reflection APIs (`System.Type`, `System.Reflection.FieldInfo`, `System.Linq.Enumerable`).
|
||||
- **No external NuGet or third-party dependencies** beyond the base class library.
|
||||
- **Dependent modules:** Any code that needs to retrieve field sizes for `MMEPossibleChannelsFields` values—likely storage or serialization components dealing with channel data.
|
||||
|
||||
## 5. Gotchas
|
||||
- **Null reference risk:** `GetFieldSize` will throw `NullReferenceException` if `CustomChannelFieldSizeAttribute` is not applied to the queried enum member (since `GetAttribute<>()` returns `null`, and `.Size` is dereferenced unconditionally). Callers must ensure the attribute is present or guard against `null`.
|
||||
- **No validation on `size`:** The constructor accepts any `int`, including negative values. No runtime checks enforce valid size constraints (e.g., `size ≥ 0`).
|
||||
- **Reflection overhead:** `GetAttribute<TAttribute>` uses reflection on every call; not suitable for hot paths without caching.
|
||||
- **Ambiguity in `MMETables` namespace:** The `MMETables.MMEPossibleChannelsFields` type is referenced but not defined here; its actual definition and available members are unknown from this file alone.
|
||||
- **No XML documentation:** The source contains no comments; behavior is inferred solely from code structure.
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Storage/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T02:10:39.376433+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "4cfe76befa81e318"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
## 1. Purpose
|
||||
This module is the `DTS.Common.Storage` assembly, a foundational .NET library intended to encapsulate storage-related functionality for the broader DTS (likely *Data Transfer System* or similar domain) platform. Based on the assembly title and namespace, its role is to provide shared, reusable abstractions and utilities for data persistence—though the provided source file (`AssemblyInfo.cs`) contains only metadata and does not expose any implementation details. As such, this file serves as the assembly manifest, defining identity, versioning, and COM visibility settings, but no actual storage logic is present here.
|
||||
|
||||
## 2. Public Interface
|
||||
**No public types, functions, classes, or methods are defined in this file.**
|
||||
`AssemblyInfo.cs` is a metadata-only file used for assembly-level attributes. It contains no executable code, interfaces, or public API surface. All public APIs (if any exist in the `DTS.Common.Storage` assembly) must reside in other source files (e.g., `.cs` files outside this directory or assembly metadata file).
|
||||
|
||||
## 3. Invariants
|
||||
- The assembly identity is fixed:
|
||||
- `AssemblyTitle = "Storage"`
|
||||
- `AssemblyProduct = "Storage"`
|
||||
- `AssemblyVersion = "1.0.0.0"`
|
||||
- `AssemblyFileVersion = "1.0.0.0"`
|
||||
- COM visibility is disabled (`ComVisible(false)`), meaning types in this assembly are not exposed to COM by default.
|
||||
- The `Guid` attribute (`b62ab8e0-42f4-4a11-bad5-0add30baad84`) uniquely identifies the typelib for COM interop *if* `ComVisible(true)` is applied to specific types (currently not the case).
|
||||
- No runtime invariants or data constraints are enforced here, as this file contains no logic.
|
||||
|
||||
## 4. Dependencies
|
||||
- **System.Reflection**, **System.Runtime.CompilerServices**, **System.Runtime.InteropServices** (via `using` directives) — standard .NET namespaces for assembly metadata and COM interop.
|
||||
- This assembly likely *depends on* other internal or external libraries (e.g., `DTS.Common.*` or storage SDKs), but no such dependencies are declared in this file.
|
||||
- **Depended upon by**: Any consumer of the `DTS.Common.Storage` assembly (e.g., other projects referencing this DLL), though this file itself does not define any public types for consumers to depend on.
|
||||
|
||||
## 5. Gotchas
|
||||
- **Misleading scope**: Developers may assume this file contains storage logic due to the namespace and assembly name, but it is purely metadata. Actual functionality resides elsewhere.
|
||||
- **Versioning rigidity**: Both `AssemblyVersion` and `AssemblyFileVersion` are hardcoded to `1.0.0.0`. This may indicate legacy status or intentional immutability, but could cause binding issues if versioning is expected to evolve.
|
||||
- **COM interop risk**: `ComVisible(false)` at the assembly level prevents accidental COM exposure, but if specific types *are* later marked `[ComVisible(true)]`, the `Guid` attribute must be manually managed to avoid breaking changes.
|
||||
- **No documentation**: The `AssemblyDescription` and `AssemblyConfiguration` are empty strings, offering no insight into build configurations or intended usage.
|
||||
- **None identified from source alone** for behavioral quirks or tech debt beyond the above.
|
||||
Reference in New Issue
Block a user