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

85 lines
8.1 KiB
Markdown

---
source_files:
- Common/DTS.Common/Interface/TestMetaData/ITestEngineerDetailsDbRecord.cs
- Common/DTS.Common/Interface/TestMetaData/ICustomerDetailsDbRecord.cs
- Common/DTS.Common/Interface/TestMetaData/ILabratoryDetailsDbRecord.cs
generated_at: "2026-04-16T02:59:59.267381+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "5fb9e524b8a88a44"
---
# Documentation: Test Metadata Record Interfaces
## 1. Purpose
This module defines a set of interfaces that describe the schema of three database tables—`TestEngineerDetails`, `CustomerDetails`, and `LabratoryDetails`—used to store metadata for testing workflows. These interfaces serve as strongly-typed contracts for data access layers (e.g., Entity Framework ORM mappings) and ensure consistency between database records and domain models. They are part of the `DTS.Common.Interface.TestMetaData` namespace and are intended to be implemented by concrete data models used throughout the system for test configuration, reporting, and auditability.
## 2. Public Interface
### `ITestEngineerDetailsDbRecord`
Represents a record in the `TestEngineerDetails` table.
- `int TestEngineerId { get; set; }` — Primary key (mapped to `TestEngineerId` column).
- `string Name { get; set; }` — Generic name field (mapped to `Name` column).
- `string TestEngineerName { get; set; }` — Full name of the test engineer (mapped to `TestEngineerName` column).
- `string TestEngineerPhone { get; set; }` — Phone number of the test engineer (mapped to `TestEngineerPhone` column).
- `string TestEngineerFax { get; set; }` — Fax number of the test engineer (mapped to `TestEngineerFax` column).
- `string TestEngineerEmail { get; set; }` — Email address of the test engineer (mapped to `TestEngineerEmail` column).
- `bool LocalOnly { get; set; }` — Flag indicating if the record is local-only (mapped to `LocalOnly` column).
- `DateTime LastModified { get; set; }` — Timestamp of last modification (mapped to `LastModified` column).
- `string LastModifiedBy { get; set; }` — User identifier who last modified the record (mapped to `LastModifiedBy` column).
- `int Version { get; set; }` — Concurrency token/version number (mapped to `Version` column).
### `ICustomerDetailsDbRecord`
Represents a record in the `CustomerDetails` table.
- `int CustomerId { get; set; }` — Primary key (mapped to `CustomerId` column).
- `string Name { get; set; }` — Generic name field (mapped to `Name` column).
- `string CustomerName { get; set; }` — Full name of the customer (mapped to `CustomerName` column).
- `string CustomerTestRefNumber { get; set; }` — Customer-specific test reference number (mapped to `CustomerTestRefNumber` column).
- `string ProjectRefNumber { get; set; }` — Project reference number (mapped to `ProjectRefNumber` column).
- `string CustomerOrderNumber { get; set; }` — Customer order number (mapped to `CustomerOrderNumber` column).
- `string CustomerCostUnit { get; set; }` — Cost center or cost unit identifier (mapped to `CustomerCostUnit` column).
- `bool LocalOnly { get; set; }` — Flag indicating if the record is local-only (mapped to `LocalOnly` column).
- `DateTime LastModified { get; set; }` — Timestamp of last modification (mapped to `LastModified` column).
- `string LastModifiedBy { get; set; }` — User identifier who last modified the record (mapped to `LastModifiedBy` column).
- `int Version { get; set; }` — Concurrency token/version number (mapped to `Version` column).
### `ILabratoryDetailsDbRecord`
Represents a record in the `LabratoryDetails` table.
- `int LabratoryId { get; set; }` — Primary key (mapped to `LabratoryId` column).
- `string Name { get; set; }` — Generic name field (mapped to `Name` column).
- `string LabratoryName { get; set; }` — Full name of the laboratory (mapped to `LabratoryName` column).
- `string LabratoryContactName { get; set; }` — Name of the laboratory contact person (mapped to `LabratoryContactName` column).
- `string LabratoryContactPhone { get; set; }` — Contact phone number (mapped to `LabratoryContactPhone` column).
- `string LabratoryContactFax { get; set; }` — Contact fax number (mapped to `LabratoryContactFax` column).
- `string LabratoryContactEmail { get; set; }` — Contact email address (mapped to `LabratoryContactEmail` column).
- `string LabratoryTestRefNumber { get; set; }` — Laboratory test reference number (mapped to `LabratoryTestRefNumber` column).
- `string LabratoryProjectRefNumber { get; set; }` — Laboratory project reference number (mapped to `LabratoryProjectRefNumber` column).
- `DateTime LastModified { get; set; }` — Timestamp of last modification (mapped to `LastModified` column).
- `string LastModifiedBy { get; set; }` — User identifier who last modified the record (mapped to `LastModifiedBy` column).
- `bool LocalOnly { get; set; }` — Flag indicating if the record is local-only (mapped to `LocalOnly` column).
- `int Version { get; set; }` — Concurrency token/version number (mapped to `Version` column).
## 3. Invariants
- **Primary Key**: Each interface defines exactly one key property (`TestEngineerId`, `CustomerId`, `LabratoryId`), marked with `[Key]` and mapped to a column of the same name.
- **Column Mapping**: All properties are explicitly mapped to database columns via `[Column("...")]` attributes; column names match the property names *except* for the key field (e.g., `TestEngineerId``TestEngineerId`, but `Name``Name`).
- **Required Fields**: No `[Required]` attributes are present, implying all string properties are nullable and optional at the database level.
- **Timestamps**: `LastModified` is a non-nullable `DateTime`; `LastModifiedBy` and `Version` are present in all interfaces, suggesting audit and concurrency control.
- **Local-Only Flag**: All interfaces include a `LocalOnly` boolean field, likely used to distinguish between centrally managed and site-specific records.
- **Versioning**: The `Version` field (type `int`) is present in all interfaces, likely used for optimistic concurrency control (e.g., EF Core row versioning).
## 4. Dependencies
- **Dependencies**:
- `System.ComponentModel.DataAnnotations` (for `[Key]`, `[Column]` attributes).
- `System` (for `DateTime`, `string`, `bool`, `int`).
- **Depended upon**:
- This module is part of `DTS.Common.Interface.TestMetaData`, implying it is consumed by downstream modules (e.g., data access layers, UI view models, or service layers) that interact with test metadata.
- Likely used by EF Core or similar ORMs to map database tables to domain models.
- No direct implementation is provided in the source files; implementations are expected in other modules (e.g., `DTS.Data` or `DTS.Domain`).
## 5. Gotchas
- **Typo in Namespace/Class Names**: The interface `ILabratoryDetailsDbRecord` and its associated table/column names use the misspelled "Labratory" (instead of "Laboratory"). This is consistent across all three files and likely reflects legacy naming; changing it would require database schema migration.
- **Redundant `Name` Field**: All interfaces include both a `Name` property and a more specific name field (e.g., `TestEngineerName`, `CustomerName`). The purpose of `Name` is unclear—possibly a generic display name or fallback—but its semantics are not documented.
- **Missing Validation**: No `[Required]`, `[StringLength]`, or regex validation attributes are applied, so consumers must enforce business rules externally (e.g., in services or UI).
- **`LocalOnly` Semantics**: The meaning of `LocalOnly` is not specified beyond its presence; its usage (e.g., filtering, sync behavior) must be inferred from implementation code.
- **No Relationship Metadata**: These interfaces define only scalar properties; foreign key relationships (e.g., to a `Test` or `Project` table) are not expressed here and must be defined elsewhere.
- **`Version` Field Type**: The `Version` field is an `int`, but EF Core typically uses `byte[]` for row versioning. If used with EF Core, this may require explicit configuration or could indicate a custom concurrency mechanism.