Files
2026-04-17 14:55:32 -04:00

2.5 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.CommonCore/Attributes/VersionAttribute.cs
2026-04-16T12:02:23.720037+00:00 zai-org/GLM-5-FP8 1 97df6c62ae44caee

Documentation: VersionAttribute

1. Purpose

VersionAttribute is a custom attribute class that allows developers to annotate code elements (classes, methods, properties, etc.) with an integer version number. It provides a simple mechanism for versioning components within the DTS system, which may be used for tracking API evolution, serialization compatibility, or feature versioning.

2. Public Interface

VersionAttribute Class

Namespace: DTS.Common.Attributes
Base Class: System.Attribute

Constructor

public VersionAttribute(int version)

Creates a new instance of the attribute with the specified version number. The version parameter is stored in the read-only Version property.

Properties

public int Version { get; private set; }

Returns the version number specified when the attribute was instantiated. This property is read-only externally; it can only be set via the constructor.

3. Invariants

  • The Version property is immutable after construction (private setter).
  • The Version value is always an int; no null state is possible since int is a value type.
  • No constraints are enforced on the range of version (negative values, zero, and positive values are all accepted).

4. Dependencies

This module depends on:

  • System — Provides the Attribute base class.
  • System.Linq — Imported but not used in the current implementation.

What depends on this module:

  • Cannot be determined from the source file alone. This attribute is defined in DTS.CommonCore, suggesting it is part of a core utilities library that other modules likely reference.

5. Gotchas

  • Unused import: The using System.Linq; directive is present but not utilized in the code. This may be leftover from refactoring or template code.
  • No AttributeUsage declaration: The attribute lacks an [AttributeUsage] specification, meaning it can be applied to any target (classes, methods, assemblies, etc.) with default behavior (allowing multiple instances = false, inherited = true). If specific usage constraints are intended, they are not enforced at the attribute definition level.
  • No version validation: The constructor accepts any integer, including negative values. If semantic versioning or positive-only constraints are expected by consumers, they are not enforced here.