7.0 KiB
7.0 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T03:29:48.963073+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 52e7e10ea2ae6d13 |
Messages
Documentation: Licensing Validation Messages
1. Purpose
This module defines core data structures used for representing license validation outcomes and license metadata within the DTS licensing system. It provides strongly-typed message contracts (ValidationResult, ValidationFailure, LicenseKey) that enable consistent communication of license status—such as validity, expiration, version compatibility, and ownership—between licensing validation components and downstream consumers (e.g., UI, service layers, or license enforcement logic). These types serve as the canonical output of license validation operations and are intended to decouple validation logic from business logic by standardizing the shape of validation results.
2. Public Interface
ValidationFailure
- Namespace:
DTS.Common.Licensing.Messages - Properties:
string Message { get; set; }– A human-readable description of the validation issue (e.g.,"License has expired").string HowToResolve { get; set; }– Guidance on how to remediate the failure (e.g.,"Renew your license at https://example.com/renew").
- Behavior: A simple DTO for encapsulating a single validation failure; no validation or side effects occur upon construction or property assignment.
LicenseKey
- Namespace:
DTS.Common.Licensing - Properties:
string KeyGuid { get; set; }– A string representation of the license’s unique identifier (likely a GUID).string PublicKey { get; set; }– The public key associated with the license (e.g., used for signature verification).
- Behavior: A lightweight DTO for conveying core license identification and cryptographic material; no validation or processing is performed.
ValidationResult
- Namespace:
DTS.Common.Licensing.Messages - Properties:
IEnumerable<ValidationFailure> ValidationFailures { get; set; }– Collection of all validation failures encountered; may benullor empty if no failures occurred.bool IsLicenseExpired { get; set; }–trueif the license has expired (based onLicenseExpiration);falseotherwise.bool IsLicenseVersionValid { get; set; }–trueif the license version is compatible with the current product version;falseotherwise.Version ProductVersion { get; set; }– The version of the product being licensed (e.g.,1.2.3.0).string LicenseVersion { get; set; }– The version string declared in the license (e.g.,"1.2").DateTime? LicenseExpiration { get; set; }– The expiration date/time of the license;nullif the license does not expire.bool IsValid { get; set; }–trueif all validation checks passed (i.e.,ValidationFailuresis empty,IsLicenseExpiredisfalse, andIsLicenseVersionValidistrue);falseotherwise.bool IsLicensed { get; set; } = true– Indicates whether a license file was present and loaded (true) or absent (false). Default value istrue.string LicensedTo { get; set; }– The entity (e.g., company or user name) to whom the license was issued.DataProLicensingEnums.LicenseType LicenseType { get; set; }– The type of license (e.g., Trial, Standard, Enterprise); defined inDataProLicensingEnums.Guid LicenseId { get; set; }– The unique identifier of the license.
- Behavior: Encapsulates the complete result of a license validation operation. The
IsValidproperty is derived from the combination of other fields (see Invariants), not computed independently.
3. Invariants
IsValidis logically dependent:IsValidmust betrueif and only if:ValidationFailuresisnullor empty,IsLicenseExpiredisfalse, andIsLicenseVersionValidistrue.
(Note: The source does not enforce this via code—e.g., no setter logic—but it is the intended semantic contract implied by the property name and comments.)
IsLicenseddefault:IsLicenseddefaults totrue; a value offalseexplicitly indicates the license file was not found or could not be loaded.LicenseExpirationmay be null: Anullvalue forLicenseExpirationsignifies a perpetual (non-expiring) license.ValidationFailuresmay be null: The property is not initialized to an empty collection by default, so consumers must handlenullexplicitly.
4. Dependencies
- Internal dependencies:
System(viaSystem.Collections.Generic,System.Linq,System.Text,System.Threading.Tasks,Systemimplicitly forVersion,DateTime,Guid).DataProLicensingEnums.LicenseType(referenced inValidationResult.LicenseType); defined in an external assembly (DTS.Common.Licensingnamespace implies a dependency onDTS.Common.Licensing.dll, but the enum itself is not defined in the provided sources).
- Consumers:
- Licensing validation services (e.g., a
LicenseValidatorclass not shown here) are expected to produceValidationResultinstances. - UI or middleware layers that consume validation results to make decisions (e.g., enabling/disabling features, prompting renewal).
- Licensing validation services (e.g., a
- No external library dependencies beyond core .NET types (e.g., no third-party packages referenced in the provided files).
5. Gotchas
ValidationFailuresis not initialized: The propertyValidationFailuresis not auto-initialized to an empty collection (e.g., via= new List<ValidationFailure>()), so consumers must check fornullbefore enumeration.IsValidis not computed automatically: Though logically defined by other properties,IsValidis a simpleboolwith no setter logic or computed backing; callers must ensure it is set consistently by the producer (e.g., validation service).IsLicenseddefault may be misleading: Its default value oftruecould cause confusion if aValidationResultis constructed without explicitly settingIsLicensed = falsewhen no license file exists.LicenseKey.KeyGuidis a string, not aGuid: Despite the name suggesting a GUID, it is stored as astring, which may include formatting (e.g., with/without dashes) or non-GUID values. Consumers should not assume parseability without validation.- No version comparison logic in
ValidationResult: WhileProductVersionandLicenseVersionare present, the class itself provides no helper for comparing them (e.g.,IsLicenseVersionValidis set externally). - Missing
LicenseKeyusage context: TheLicenseKeyclass is defined but no usage or relationship toValidationResult/ValidationFailureis evident from these files alone (e.g., whetherLicenseKeyis used as input to validation).