51 lines
4.2 KiB
Markdown
51 lines
4.2 KiB
Markdown
|
|
---
|
|||
|
|
source_files:
|
|||
|
|
- Common/DTS.Common/Enums/Groups/GroupList/GroupFields.cs
|
|||
|
|
generated_at: "2026-04-16T03:21:38.019315+00:00"
|
|||
|
|
model: "Qwen/Qwen3-Coder-Next-FP8"
|
|||
|
|
schema_version: 1
|
|||
|
|
sha256: "79ab94ade566b7fd"
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
# GroupList
|
|||
|
|
|
|||
|
|
## 1. Purpose
|
|||
|
|
This module defines a strongly-typed enumeration `GroupFields` used to represent the set of standard, queryable fields associated with *Group* entities in the system. It serves as a canonical list of field identifiers—typically for use in filtering, sorting, or projecting group data—while leveraging .NET’s `DescriptionAttribute` and a custom `EnumDescriptionTypeConverter` to support localized or metadata-driven string representations (e.g., for UI labels or API contracts). Its role is to decouple field naming logic from business logic and ensure consistency across data access, serialization, and UI layers.
|
|||
|
|
|
|||
|
|
## 2. Public Interface
|
|||
|
|
The module exposes a single public type:
|
|||
|
|
|
|||
|
|
- **`GroupFields`** (`enum`)
|
|||
|
|
An enumeration of group entity fields. Each member is annotated with a `DescriptionAttribute` containing a string key (not the literal description text), intended for localization or lookup via `EnumDescriptionTypeConverter`.
|
|||
|
|
Members:
|
|||
|
|
- `Name` → `Description("GroupField_Name")`
|
|||
|
|
- `DisplayName` → `Description("GroupField_DisplayName")`
|
|||
|
|
- `Description` → `Description("GroupField_Description")`
|
|||
|
|
- `ChannelCount` → `Description("GroupField_ChannelCount")`
|
|||
|
|
- `LastModified` → `Description("GroupField_LastModified")`
|
|||
|
|
- `LastModifiedBy` → `Description("GroupField_LastModifiedBy")`
|
|||
|
|
- `AssociatedTestSetups` → `Description("GroupField_AssociatedTestSetups")`
|
|||
|
|
|
|||
|
|
*Note:* The actual human-readable descriptions (e.g., `"Name"`, `"Display Name"`) are *not* embedded in this enum; they are resolved externally (e.g., via resource files) using the `EnumDescriptionTypeConverter`.
|
|||
|
|
|
|||
|
|
## 3. Invariants
|
|||
|
|
- All enum values are **exclusively defined** in this file; no dynamic or runtime additions are supported.
|
|||
|
|
- The `DescriptionAttribute` on each member **must contain a non-empty string key** (e.g., `"GroupField_Name"`), but the *value* of the key is not validated by this module—it is assumed to be resolvable by the `EnumDescriptionTypeConverter`.
|
|||
|
|
- The enum is **not marked `[Flags]`**, implying only one field may be selected at a time in typical usage (e.g., for single-field sorting or filtering).
|
|||
|
|
- The `TypeConverter` attribute ensures that when the enum is converted to/from a string (e.g., in UI binding or JSON deserialization), the `EnumDescriptionTypeConverter` is used—*not* the default `Enum.ToString()` behavior.
|
|||
|
|
|
|||
|
|
## 4. Dependencies
|
|||
|
|
- **Imports/References**:
|
|||
|
|
- `DTS.Common.Converters` (for `EnumDescriptionTypeConverter`)
|
|||
|
|
- `System.ComponentModel` (for `DescriptionAttribute` and `TypeConverterAttribute`)
|
|||
|
|
- **Consumers (inferred)**:
|
|||
|
|
- Any module that needs to reference group fields in a type-safe manner (e.g., query builders, DTO mappers, UI view models).
|
|||
|
|
- `EnumDescriptionTypeConverter` (in `DTS.Common.Converters`) is required at runtime to interpret `DescriptionAttribute` values.
|
|||
|
|
- Likely used in conjunction with group-related data models (e.g., `Group`, `GroupDto`) and data access layers (e.g., LINQ-to-SQL or EF Core projections), though these are not visible in the source.
|
|||
|
|
|
|||
|
|
## 5. Gotchas
|
|||
|
|
- The `DescriptionAttribute` values (e.g., `"GroupField_Name"`) are **keys, not display strings**—they must be resolved externally (e.g., via `ResourceManager` or a dictionary) by `EnumDescriptionTypeConverter`. Assuming the literal string is the display value will cause incorrect behavior.
|
|||
|
|
- The enum is **not exhaustive**; if new group fields are added to the underlying data model (e.g., `CreatedDate`), this enum *must* be updated manually—no automatic sync is implied.
|
|||
|
|
- The `TypeConverter` behavior is *not* self-contained here: if `EnumDescriptionTypeConverter` is misconfigured or missing, enum-to-string conversions (e.g., in JSON.NET, MVC model binding, or XAML bindings) may fail or produce unexpected keys instead of localized text.
|
|||
|
|
- No validation or ordering guarantees are enforced—consumers must independently handle invalid field names or enforce field-specific constraints (e.g., disallowing `ChannelCount` in certain queries).
|
|||
|
|
- None identified from source alone.
|