Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common/Enums/Groups/GroupList.md
2026-04-17 14:55:32 -04:00

4.2 KiB
Raw Blame History

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common/Enums/Groups/GroupList/GroupFields.cs
2026-04-16T03:21:38.019315+00:00 Qwen/Qwen3-Coder-Next-FP8 1 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 .NETs 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:

    • NameDescription("GroupField_Name")
    • DisplayNameDescription("GroupField_DisplayName")
    • DescriptionDescription("GroupField_Description")
    • ChannelCountDescription("GroupField_ChannelCount")
    • LastModifiedDescription("GroupField_LastModified")
    • LastModifiedByDescription("GroupField_LastModifiedBy")
    • AssociatedTestSetupsDescription("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.