88 lines
5.9 KiB
Markdown
88 lines
5.9 KiB
Markdown
---
|
||
source_files:
|
||
- Common/DTS.Common.Serialization/StringResources/Strings.Designer.cs
|
||
generated_at: "2026-04-16T03:35:11.595003+00:00"
|
||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||
schema_version: 1
|
||
sha256: "0432c06ee66319f4"
|
||
---
|
||
|
||
# StringResources
|
||
|
||
## Documentation Page: `DTS.Serialization.StringResources.Strings`
|
||
|
||
---
|
||
|
||
### 1. **Purpose**
|
||
|
||
This module provides a strongly-typed, auto-generated resource class (`Strings`) for accessing localized string resources used throughout the DTS serialization subsystem—specifically in error and diagnostic messaging related to slice control logic, event handling, DAS (Data Acquisition System) list validation, and equality comparisons. It serves as a centralized, compile-time-safe abstraction layer over the underlying `ResourceManager`, enabling developers to retrieve localized messages by strongly-typed property access rather than string keys. The class is not intended for direct business logic use but for consistent, localized error reporting in higher-level components (e.g., validation, comparison, or construction failures).
|
||
|
||
---
|
||
|
||
### 2. **Public Interface**
|
||
|
||
All members are `internal` (not `public`), meaning they are only accessible within the same assembly (`DTS.Serialization.StringResources`). No types or methods are exposed to external consumers.
|
||
|
||
#### Class: `Strings`
|
||
- **Namespace**: `DTS.Serialization.StringResources`
|
||
- **Attributes**: `[GeneratedCode]`, `[DebuggerNonUserCode]`, `[CompilerGenerated]`
|
||
- **Constructor**:
|
||
`internal Strings()`
|
||
Private parameterless constructor; prevents external instantiation.
|
||
|
||
- **Static Properties** (read-only accessors to localized strings):
|
||
- `internal static ResourceManager ResourceManager { get; }`
|
||
Returns a cached `ResourceManager` instance for the resource file `"DTS.Serialization.StringResources.Strings"`. Lazily initializes on first access.
|
||
|
||
- `internal static CultureInfo Culture { get; set; }`
|
||
Gets or sets the UI culture used for resource lookups. Overrides the current thread’s `CurrentUICulture` for all lookups via this class.
|
||
|
||
- **String Properties** (each returns a localized string for a specific message key):
|
||
- `internal static string DTS_Slice_Control_Equals_ComparisonFailedString { get; }`
|
||
- `internal static string DTS_Slice_Control_Event_ConstructionFailedString { get; }`
|
||
- `internal static string DTS_Slice_Control_Event_Event_DASTestIdMismatchString { get; }`
|
||
- `internal static string DTS_Slice_Control_Event_Event_EmptyDasListString { get; }`
|
||
- `internal static string DTS_Slice_Control_Event_Event_FailedToDetermineIdOrDescriptionFromConfigurationString { get; }`
|
||
- `internal static string DTS_Slice_Control_Event_Event_NullDasListString { get; }`
|
||
- `internal static string DTS_Slice_Control_Event_Module_Channel_DataEquals_ComparisonFailedString { get; }`
|
||
- `internal static string DTS_Slice_Control_Event_Module_ChannelsEquals_ComparisonFailedString { get; }`
|
||
- `internal static string DTS_Slice_Control_Event_Module_TriggerSampleNumbersEquals_ComparisonFailedString { get; }`
|
||
- `internal static string DTS_Slice_Control_Event_ModuleEquals_ComparisonFailedString { get; }`
|
||
- `internal static string DTS_Slice_Control_NullIndicatorString { get; }`
|
||
|
||
Each property internally calls `ResourceManager.GetString(key, resourceCulture)`.
|
||
|
||
---
|
||
|
||
### 3. **Invariants**
|
||
|
||
- The class is **thread-safe for read-only access** to `ResourceManager` and `Culture` due to the null-check-and-assign pattern in `ResourceManager` (though not explicitly guarded with locks—relies on .NET’s thread-safe initialization of static fields).
|
||
- `resourceCulture` is `null` by default; if set, it overrides the thread’s `CurrentUICulture` for all subsequent lookups.
|
||
- All string keys are **hardcoded in the property getters** and must match keys in the corresponding `.resx` file (e.g., `DTS_Slice_Control_Equals_ComparisonFailedString`). Mismatches would cause runtime `MissingManifestResourceException` or `NullReferenceException` (if `GetString` returns `null`).
|
||
- The class is **immutable at runtime**—no mutable state beyond the static `resourceMan` and `resourceCulture` fields.
|
||
|
||
---
|
||
|
||
### 4. **Dependencies**
|
||
|
||
- **Depends on**:
|
||
- `System.Resources.ResourceManager`
|
||
- `System.Globalization.CultureInfo`
|
||
- The compiled satellite or main assembly containing the corresponding `.resx` file (expected to be embedded as `DTS.Serialization.StringResources.Strings.resources`).
|
||
- `System.CodeDom.Compiler`, `System.Diagnostics`, `System.Runtime.CompilerServices`, `System.ComponentModel` (via attributes).
|
||
|
||
- **Used by**:
|
||
- Other components in the `DTS.Serialization` namespace (e.g., comparison logic, event construction/validation code) that need to throw or log localized messages using the above keys.
|
||
*(Exact consumers are not visible in this file alone, but naming conventions strongly suggest usage in slice control, event, module, channel, and DAS list validation code.)*
|
||
|
||
---
|
||
|
||
### 5. **Gotchas**
|
||
|
||
- **Auto-generated**: This file is regenerated automatically (e.g., via ResGen or Visual Studio build). **Manual edits will be overwritten**. Changes must be made in the source `.resx` file.
|
||
- **No null-safety guarantee**: `ResourceManager.GetString(...)` may return `null` if a key is missing from the `.resx` file (e.g., due to a mismatch between key name and resource file). This could lead to `NullReferenceException` if callers assume non-null return.
|
||
- **No documentation of actual string values**: The XML comments only show *sample* text (e.g., `"DTS_Slice_Control_Equals_ComparisonFailedString"`), not the real localized content. The actual messages are defined in the `.resx` file (not provided here).
|
||
- **No public API surface**: This is an internal helper—consumers must be in the same assembly. External callers cannot reference it directly.
|
||
- **Culture override behavior**: Setting `Strings.Culture` affects *all* subsequent lookups in the AppDomain, which may cause unintended side effects in multi-threaded scenarios if not coordinated.
|
||
|
||
None identified beyond the above. |