init
This commit is contained in:
153
enriched-partialglm/Common/DTS.Common.Storage/Classes.md
Normal file
153
enriched-partialglm/Common/DTS.Common.Storage/Classes.md
Normal file
@@ -0,0 +1,153 @@
|
||||
---
|
||||
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-16T11:53:30.528055+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "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:**
|
||||
```csharp
|
||||
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.
|
||||
@@ -0,0 +1,127 @@
|
||||
---
|
||||
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-16T11:55:23.145140+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "275c64f80988749d"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Storage Schema Definitions
|
||||
|
||||
## 1. Purpose
|
||||
This module provides a collection of abstract classes that serve as schema definitions for the DTS storage system. It centralizes database table names and column identifiers into static constants and enumerations. Its primary role is to provide type-safe, compile-time references for database entities—such as Users, Sensors, TestSetups, and various hardware configurations—decoupling the codebase from raw string literals used in SQL queries or data access layers.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
The module consists of the following abstract classes, which cannot be instantiated but provide static members for schema reference.
|
||||
|
||||
### `MMEPossibleChannels`
|
||||
* **`const string Table`**: Value `"tblMMEPossibleChannels"`.
|
||||
|
||||
### `DbVersions` (Namespace: `Storage.Classes.Abstract`)
|
||||
* **`enum DbVersionFields`**: Members: `Version`, `Step`, `Date`, `Remarks`, `UserField`.
|
||||
|
||||
### `Settings`
|
||||
* **`const string Table`**: Value `"tblSettings"`.
|
||||
* **`enum UserFields`**: Members: `PropertyId`, `PropertyType`, `PropertyValue`, `UserId`.
|
||||
|
||||
### `VersionTable`
|
||||
* **`const string TableName`**: Value `"tblDataPRODbVersion"`.
|
||||
* **`enum Fields`**: Members: `Version`, `Step`, `Date`, `Remarks`, `UserField`.
|
||||
|
||||
### `TestObjectChannelSettings`
|
||||
* **`const string TableName`**: Value `"tblTestObjectChannelSettings"`.
|
||||
* **`enum Fields`**: Members: `TestObjectSerial`, `ChannelId`, `Setting`, `SensorSerial`.
|
||||
|
||||
### `Tags`
|
||||
* **`const string Table`**: Value `"tblTags"`.
|
||||
* **`enum TagFields`**: Members: `TagId`, `TagText`, `Obssolete`.
|
||||
* **`const string TAGASSIGNMENTS_TABLE`**: Value `"TagAssignments"`.
|
||||
* **`enum TagAssignmentFields`**: Members: `ObjectID`, `ObjectType`, `TagID`.
|
||||
|
||||
### `DigitalOutputSettings`
|
||||
* **`const string Table`**: Value `"tblTOMDigitalChannels"`.
|
||||
* **`enum Fields`**: Members: `ChannelDescription`, `DelayMS`, `DurationMS`, `OutputMode`, `LimitDuration`, `LastModified`, `LastModifiedBy`, `Version`, `LocalOnly`, `DurationMSFloat`, `UserTags`.
|
||||
|
||||
### `LabratoryDetails`
|
||||
* **`const string Table`**: Value `"tblLabratoryDetails"`.
|
||||
* **`enum LabratoryDetailsFields`**: Members: `Name`, `LabratoryName`, `LabratoryContactName`, `LabratoryContactPhone`, `LabratoryContactFax`, `LabratoryContactEmail`, `LabratoryTestRefNumber`, `LabratoryProjectRefNumber`, `LastModified`, `LastModifiedBy`, `LocalOnly`, `Version`.
|
||||
|
||||
### `Squib`
|
||||
* **`const string Table`**: Value `"tblTOMSquibChannels"`.
|
||||
* **`enum Fields`**: Members: `SquibDescription`, `BypassCurrentFilter`, `BypassVoltageFilter`, `DelayMS`, `DurationMS`, `FireMode`, `ISOCode`, `MeasurementType`, `SquibOutputCurrent`, `SquibToleranceLow`, `SquibToleranceHigh`, `LimitDuration`, `ArticleId`, `LocalOnly`, `Version`, `LastModified`, `LastModifiedBy`, `UserValue1`, `UserValue2`, `UserValue3`, `UserTags`.
|
||||
|
||||
### `CalculatedChannels`
|
||||
* **`const string Table`**: Value `"tblCalculatedChannels"`.
|
||||
* **`enum Fields`**: Members decorated with `DbTypeAttr`:
|
||||
* `Id` (`INTEGER PRIMARY KEY NOT NULL`)
|
||||
* `Operation` (`INTEGER`)
|
||||
* `CalculatedChannelValueCode` (`NVARCHAR(255)`)
|
||||
* `InputChannelIds` (`BLOB`)
|
||||
* `CFCForInputChannels` (`NVARCHAR(255)`)
|
||||
* `CFCForOutput` (`NVARCHAR(255)`)
|
||||
* `TestSetupName` (`NVARCHAR(255)`)
|
||||
* `CCName` (`NVARCHAR(255)`)
|
||||
|
||||
### `Users`
|
||||
* **`const string USERS_TABLE`**: Value `"DataPROUsers"`.
|
||||
* **`enum UserFields`**: Members: `ID`, `UserName`, `DisplayName`, `Password`, `Role`, `LastModified`, `LastModifiedBy`, `LocalOnly`.
|
||||
* **`const string UIITEMS_TABLE`**: Value `"UIITEMS"`.
|
||||
* **`enum UIItemFields`**: Members: `ID`, `Name`.
|
||||
* **`const string USERUISETTINGS_TABLE`**: Value `"UserUIItemSettings"`.
|
||||
* **`enum UserUIItemSettingFields`**: Members: `UserId`, `UIItemID`, `Permission`, `Visible`.
|
||||
|
||||
### `LevelTriggers`
|
||||
* **`const string Table`**: Value `"tblLevelTriggers"`.
|
||||
* **`enum Fields`**: Members decorated with `DbTypeAttr` (e.g., `TestSetupName`, `GroupSerialNumber`, `HardwareChannelId`, `GreaterThanEnabled`, `GreaterThanEU`, etc.).
|
||||
|
||||
### `SensorDB`
|
||||
* **`const string SensorCalibrationTable`**: Value `"tblSensorCalibrations"`.
|
||||
* **`const string SensorDataTable`**: Value `"tblSensors"`.
|
||||
* **`const string SensorModelsTable`**: Value `"tblSensorModels"`.
|
||||
* **`enum SensorDataFields`**: Members include `SerialNumber`, `UserSerialNumber`, `Model`, `Manufacturer`, `Status`, `MeasurementUnit`, `OffsetToleranceLow`, `OffsetToleranceHigh`, `Id`, etc.
|
||||
* **`enum SensorModelFields`**: Members include `Model`, `Manufacturer`, `UserPartNumber`, `Capacity`, etc.
|
||||
* **`enum SensorCalibrationFields`**: Members include `SerialNumber`, `CalibrationDate`, `Username`, `NonLinear`, etc.
|
||||
* **`enum SensorCalibrationRecordFields`**: Members include `Sensitivity`, `Poly`, `AtCapacity`, etc.
|
||||
|
||||
### `TestSetups`
|
||||
* **`const string HardwareTable`**: Value `"tblTestSetupHardware"`.
|
||||
* **`enum HardwareFields`**: Members: `TestSetupName`, `HardwareId`, `AddOrRemove`.
|
||||
* **`const string DASSettingsTable`**: Value `"tblTestSetupDASSettings"`.
|
||||
* **`const string ChannelSettingsTable`**: Value `"tblTestChannelSettings"`.
|
||||
* **`enum ChannelSettingFields`**: Members: `TestName`, `TestObjectName`, `ChannelId`, `Setting`, `SensorSerial`.
|
||||
* **`const string TestSetupsTable`**: Value `"tblTestSetups"`.
|
||||
* **`enum Fields`**: Extensive list including `SetupName`, `SetupDescription`, `AutomaticTestProgression`, `SamplesPerSecond`, `PreTriggerSeconds`, `PostTriggerSeconds`, `ExportFormat`, etc.
|
||||
* **`const string TestSetupObjectsTable`**: Value `"tblTestSetupObjects"`.
|
||||
* **`enum TestSetupObjectFields`**: Members: `TestObjectSerialNumber`, `TestSetupName`, `TargetSampleRate`, `ExcitationWarmupTimeMS`, `LocalOnly`, `TestObjectType`, `TestObjectPosition`.
|
||||
* **`const string TestObjectMetaDataTable`**: Value `"tblTestSetupObjectMetaData"`.
|
||||
* **`enum TestObjectMetaDataFields`**: Members: `TestObject`, `SetupName`, `PropName`, `PropValue`, `Optional`, `Version`.
|
||||
* **`const string TestObjectTemplatesTable`**: Value `"tblTestObjectTemplates"`.
|
||||
* **`enum TestObjectTemplatesFields`**: Members: `TemplateName`, `Icon`, `Description`, `LocalOnly`, `Version`, `LastModifiedBy`, `CRC32`, `TestObject`, `LastModified`, `ParentTemplate`, `SysBuilt`.
|
||||
* **`const string TestObjectsTable`**: Value `"tblTestObjects"`.
|
||||
* **`enum TestObjectsFields`**: Members: `SerialNumber`, `LastModifiedBy`, `LastModified`, `Template`, `LocalOnly`, `ParentObject`, `SysBuilt`, `Embedded`, `OriginalTemplate`, `OriginalSerialNumber`.
|
||||
* **`const string TestGraphsTable`**: Value `"tblTestGraphs"`.
|
||||
* **`enum GraphFields`**: Members: `GraphName`, `GraphDescription`, `TemplateName`, `Channels`, `UseDomainMin`, `DomainMin`, etc.
|
||||
|
||||
## 3. Invariants
|
||||
* **Abstract Definition**: All schema classes (`MMEPossibleChannels`, `Settings`, `Users`, etc.) are declared `abstract`. They are intended to be used as static containers for constants and enums, not instantiated.
|
||||
* **Enum Usage**: Nested enums are used to define field names. This implies the system likely casts these enum values to integers or strings (via `.ToString()`) when constructing queries, or uses them for array indexing.
|
||||
* **Attribute Metadata**: Only `CalculatedChannels` and `LevelTriggers` utilize the `[DbTypeAttr]` attribute. The absence of this attribute on other classes implies that schema type inference (if used) relies on default mappings or a different mechanism for those classes.
|
||||
|
||||
## 4. Dependencies
|
||||
* **Internal Dependencies**: The source files do not contain `using` statements for external libraries, indicating they are self-contained data structures.
|
||||
* **External Consumers**: Any module handling database persistence (DAOs, Repositories, SQL builders) within the `DTS`
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Storage/Classes/Static/CustomChannelFieldSizeAttribute.cs
|
||||
generated_at: "2026-04-16T11:54:41.555458+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "96c94c51da2a1b2d"
|
||||
---
|
||||
|
||||
# Documentation: CustomChannelFieldSizeAttribute.cs
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a mechanism for associating fixed size metadata with enum values (specifically `MMETables.MMEPossibleChannelsFields`), enabling retrieval of custom field sizes via reflection. It exists to decouple size configuration from business logic, allowing channel field sizes to be defined declaratively as attributes on enum members rather than hard-coded elsewhere.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `CustomChannelFieldSizeAttribute` (Class)
|
||||
A custom attribute that stores an integer size value.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `internal CustomChannelFieldSizeAttribute(int size)` | Creates an instance with the specified size. **Note: Internal access only.** |
|
||||
| Property | `public int Size { get; private set; }` | Gets the size value. Read-only after construction. |
|
||||
|
||||
### `CustomChannelFieldSizeExtensions` (Static Class)
|
||||
Provides helper methods for retrieving field sizes.
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetFieldSize` | `public static int GetFieldSize(MMETables.MMEPossibleChannelsFields field)` | Retrieves the `Size` value from the `CustomChannelFieldSizeAttribute` applied to the given enum value. **Not an extension method**—must be called statically. |
|
||||
|
||||
### `EnumExtensions` (Static Class)
|
||||
Provides generic reflection-based attribute retrieval for enum values.
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetAttribute<TAttribute>` | `public static TAttribute GetAttribute<TAttribute>(this Enum value) where TAttribute : Attribute` | Extension method that retrieves a single custom attribute of type `TAttribute` from the given enum value. Returns `null` if not found; throws `InvalidOperationException` if multiple matching attributes exist. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Attribute Application**: `GetFieldSize` assumes that `CustomChannelFieldSizeAttribute` is always applied to the passed `MMEPossibleChannelsFields` enum value. If the attribute is missing, a `NullReferenceException` will occur.
|
||||
- **Single Attribute Constraint**: `GetAttribute<TAttribute>` uses `SingleOrDefault()`, enforcing that at most one attribute of a given type may be present on any enum value. Multiple attributes of the same type will cause an `InvalidOperationException`.
|
||||
- **Immutability**: The `Size` property is set only at construction and cannot be modified thereafter (private setter).
|
||||
- **Construction Restriction**: The attribute constructor is `internal`, meaning attributes can only be defined within the same assembly.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `System` (for `Attribute`, `Enum`, `Type` reflection APIs)
|
||||
- `System.Linq` (for `OfType<T>()`, `SingleOrDefault()`)
|
||||
- `MMETables.MMEPossibleChannelsFields` — an external enum type that this module is designed to annotate. **Location/assembly not visible in source.**
|
||||
|
||||
### What depends on this module:
|
||||
- Cannot be determined from source alone. Consumers would be any code that needs to retrieve field sizes for `MMEPossibleChannelsFields` enum values.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **`GetFieldSize` is NOT an extension method** — Despite being defined in a class named `CustomChannelFieldSizeExtensions`, the method lacks the `this` keyword on its parameter. It must be called as `CustomChannelFieldSizeExtensions.GetFieldSize(field)`, not `field.GetFieldSize()`.
|
||||
|
||||
2. **Potential `NullReferenceException`** — `GetFieldSize` directly accesses `.Size` on the result of `GetAttribute<CustomChannelFieldSizeAttribute>()` without null-checking. If the enum value lacks this attribute, the method will throw.
|
||||
|
||||
3. **Internal constructor limits extensibility** — The `internal` constructor means consumers outside this assembly cannot create new instances of `CustomChannelFieldSizeAttribute`. This is likely intentional to control where/how the attribute is applied, but could be restrictive for testing or extension scenarios.
|
||||
|
||||
4. **Tight coupling to specific enum type** — `GetFieldSize` is hardcoded to `MMETables.MMEPossibleChannelsFields`, making this utility non-reusable for other enums even though `GetAttribute<T>` is generic.
|
||||
46
enriched-partialglm/Common/DTS.Common.Storage/Properties.md
Normal file
46
enriched-partialglm/Common/DTS.Common.Storage/Properties.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Storage/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T11:53:53.492402+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "4cfe76befa81e318"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Storage Assembly Configuration
|
||||
|
||||
## 1. Purpose
|
||||
This file provides assembly-level metadata and configuration for the `DTS.Common.Storage` component (compiled as "Storage.dll"). It defines the assembly's identity, version, and COM visibility settings. As a standard .NET assembly information file, it serves as the central manifest for the library's attributes within the broader "DTS.Common" namespace.
|
||||
|
||||
## 2. Public Interface
|
||||
This file contains no public classes, methods, or functions. It strictly defines assembly-level attributes using C# attribute syntax.
|
||||
|
||||
**Defined Attributes:**
|
||||
|
||||
* **`AssemblyTitle`**: Set to `"Storage"`. Provides a friendly name for the assembly.
|
||||
* **`AssemblyDescription`**: Set to an empty string. Intended for a summary of the assembly's purpose but currently undefined.
|
||||
* **`AssemblyCompany`**: Set to an empty string.
|
||||
* **`AssemblyProduct`**: Set to `"Storage"`.
|
||||
* **`AssemblyCopyright`**: Set to `"Copyright © 2012"`.
|
||||
* **`AssemblyCulture`**: Set to an empty string (neutral culture).
|
||||
* **`ComVisible`**: Set to `false`. Prevents types within this assembly from being visible to COM components.
|
||||
* **`Guid`**: Set to `"b62ab8e0-42f4-4a11-bad5-0add30baad84"`. A unique identifier for the assembly, required if COM interop is ever enabled.
|
||||
* **`AssemblyVersion`**: Set to `"1.0.0.0"`. Defines the version number used by the CLR binding system.
|
||||
* **`AssemblyFileVersion`**: Set to `"1.0.0.0"`. Defines the version number displayed in the file properties (Win32 file version resource).
|
||||
|
||||
## 3. Invariants
|
||||
* **Version Consistency:** Both `AssemblyVersion` and `AssemblyFileVersion` are currently synchronized at `"1.0.0.0"`.
|
||||
* **COM Visibility:** The assembly is explicitly configured to hide types from COM (`ComVisible(false)`). If specific types need to be exposed to COM later, this attribute must be set to `true` or overridden on specific classes.
|
||||
* **Identity:** The `Guid` attribute provides a permanent unique identity for this specific assembly.
|
||||
|
||||
## 4. Dependencies
|
||||
* **Internal Dependencies (Imports):**
|
||||
* `System.Reflection`
|
||||
* `System.Runtime.CompilerServices`
|
||||
* `System.Runtime.InteropServices`
|
||||
* **External Dependents:** Unknown from this source alone. Any project referencing the compiled `DTS.Common.Storage` assembly depends on the version and metadata defined here.
|
||||
|
||||
## 5. Gotchas
|
||||
* **Legacy Timestamp:** The `AssemblyCopyright` attribute contains a hardcoded year of 2012, suggesting this is a legacy codebase that may not have been updated recently.
|
||||
* **Missing Description:** The `AssemblyDescription` is empty. Developers investigating this assembly via tools or object browsers will not see a summary description of its purpose.
|
||||
* **Hardcoded Version:** The version numbers are hardcoded to `1.0.0.0`. In modern CI/CD pipelines, this file typically requires patching during the build process to reflect accurate build numbers, or it should be migrated to a modern SDK-style project format where versioning is often handled in the project file (`.csproj`).
|
||||
Reference in New Issue
Block a user