Files
DP44/enriched-qwen3-coder-next/Common/DTS.CommonCore/Interface/TestMetaData.md

99 lines
8.8 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.CommonCore/Interface/TestMetaData/ITestEngineerDetailsDbRecord.cs
- Common/DTS.CommonCore/Interface/TestMetaData/ICustomerDetailsDbRecord.cs
- Common/DTS.CommonCore/Interface/TestMetaData/ILabratoryDetailsDbRecord.cs
generated_at: "2026-04-16T02:19:49.438916+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "adb5cdc8cb4cf74e"
---
# Documentation: Test Metadata Interfaces
## 1. Purpose
This module defines a set of interfaces that represent the schema of three database tables—`TestEngineerDetails`, `CustomerDetails`, and `LabratoryDetails`—used to store metadata about test participants and associated entities. These interfaces serve as data contracts for ORM (e.g., Entity Framework) mapping, enabling strongly-typed access to test-related metadata without exposing underlying database implementation details. They are part of the `DTS.Common.Interface.TestMetaData` namespace and are intended for use across the system wherever test metadata records need to be consumed or persisted.
## 2. Public Interface
### `ITestEngineerDetailsDbRecord`
Represents a record from the `TestEngineerDetails` table.
| Member | Type | Description |
|--------|------|-------------|
| `int TestEngineerId { get; set; }` | Property | Primary key; maps to `TestEngineerId` column. |
| `string Name { get; set; }` | Property | General name field; maps to `Name` column. |
| `string TestEngineerName { get; set; }` | Property | Full name of the test engineer; maps to `TestEngineerName` column. |
| `string TestEngineerPhone { get; set; }` | Property | Phone number of the test engineer; maps to `TestEngineerPhone` column. |
| `string TestEngineerFax { get; set; }` | Property | Fax number of the test engineer; maps to `TestEngineerFax` column. |
| `string TestEngineerEmail { get; set; }` | Property | Email address of the test engineer; maps to `TestEngineerEmail` column. |
| `bool LocalOnly { get; set; }` | Property | Indicates if the record is local-only (not shared); maps to `LocalOnly` column. |
| `DateTime LastModified { get; set; }` | Property | Timestamp of last modification; maps to `LastModified` column. |
| `string LastModifiedBy { get; set; }` | Property | User identifier who last modified the record; maps to `LastModifiedBy` column. |
| `int Version { get; set; }` | Property | Concurrency token for optimistic locking; maps to `Version` column. |
### `ICustomerDetailsDbRecord`
Represents a record from the `CustomerDetails` table.
| Member | Type | Description |
|--------|------|-------------|
| `int CustomerId { get; set; }` | Property | Primary key; maps to `CustomerId` column. |
| `string Name { get; set; }` | Property | General name field; maps to `Name` column. |
| `string CustomerName { get; set; }` | Property | Full name of the customer; maps to `CustomerName` column. |
| `string CustomerTestRefNumber { get; set; }` | Property | Reference number assigned by the customer for the test; maps to `CustomerTestRefNumber` column. |
| `string ProjectRefNumber { get; set; }` | Property | Project reference number; maps to `ProjectRefNumber` column. |
| `string CustomerOrderNumber { get; set; }` | Property | Order number from the customer; maps to `CustomerOrderNumber` column. |
| `string CustomerCostUnit { get; set; }` | Property | Cost center or unit associated with the customer; maps to `CustomerCostUnit` column. |
| `bool LocalOnly { get; set; }` | Property | Indicates if the record is local-only; maps to `LocalOnly` column. |
| `DateTime LastModified { get; set; }` | Property | Timestamp of last modification; maps to `LastModified` column. |
| `string LastModifiedBy { get; set; }` | Property | User identifier who last modified the record; maps to `LastModifiedBy` column. |
| `int Version { get; set; }` | Property | Concurrency token for optimistic locking; maps to `Version` column. |
### `ILabratoryDetailsDbRecord`
Represents a record from the `LabratoryDetails` table.
| Member | Type | Description |
|--------|------|-------------|
| `int LabratoryId { get; set; }` | Property | Primary key; maps to `LabratoryId` column. |
| `string Name { get; set; }` | Property | General name field; maps to `Name` column. |
| `string LabratoryName { get; set; }` | Property | Full name of the laboratory; maps to `LabratoryName` column. |
| `string LabratoryContactName { get; set; }` | Property | Name of the laboratory contact person; maps to `LabratoryContactName` column. |
| `string LabratoryContactPhone { get; set; }` | Property | Phone number of the laboratory contact; maps to `LabratoryContactPhone` column. |
| `string LabratoryContactFax { get; set; }` | Property | Fax number of the laboratory contact; maps to `LabratoryContactFax` column. |
| `string LabratoryContactEmail { get; set; }` | Property | Email address of the laboratory contact; maps to `LabratoryContactEmail` column. |
| `string LabratoryTestRefNumber { get; set; }` | Property | Reference number assigned by the laboratory for the test; maps to `LabratoryTestRefNumber` column. |
| `string LabratoryProjectRefNumber { get; set; }` | Property | Project reference number from the laboratory; maps to `LabratoryProjectRefNumber` column. |
| `bool LocalOnly { get; set; }` | Property | Indicates if the record is local-only; maps to `LocalOnly` column. |
| `DateTime LastModified { get; set; }` | Property | Timestamp of last modification; maps to `LastModified` column. |
| `string LastModifiedBy { get; set; }` | Property | User identifier who last modified the record; maps to `LastModifiedBy` column. |
| `int Version { get; set; }` | Property | Concurrency token for optimistic locking; maps to `Version` column. |
## 3. Invariants
- Each interface defines a single primary key property (`TestEngineerId`, `CustomerId`, `LabratoryId`) annotated with `[Key]` and mapped to a column of the same name (via `[Column("...")]`).
- All interfaces include the following shared metadata fields:
- `Name` (string, not nullable per column mapping)
- `LocalOnly` (boolean)
- `LastModified` (non-nullable `DateTime`)
- `LastModifiedBy` (string, not nullable per column mapping)
- `Version` (non-nullable `int`)
- The `Name` property is mapped to the same column name across all three interfaces, suggesting a common convention for a generic display name.
- The `LocalOnly` field is consistently defined as a `bool` and mapped to the `LocalOnly` column in all tables, implying a uniform business rule for record scope (local vs. shared).
- All string properties are nullable by default (no `[Required]` attribute), but their column mappings do not explicitly indicate nullability—implementation may assume non-nullability based on DB schema, but this is not enforced in the interface.
## 4. Dependencies
- **Dependencies of this module**:
- `System.ComponentModel.DataAnnotations` (for `[Key]`, `[Column]`)
- `System` (for `DateTime`, `string`, `bool`, `int`)
- **Depended upon by**:
- Any module that consumes or persists test metadata records (e.g., data access layers, services, UI models).
- Likely used in conjunction with Entity Framework or similar ORM (e.g., as `DbSet<ITestEngineerDetailsDbRecord>`—though interfaces cannot be directly mapped by EF, they likely serve as contracts for concrete entity classes).
- No direct references to other modules are visible in the source; dependencies are inferred from usage context.
## 5. Gotchas
- **Typo in namespace/table name**: The interface `ILabratoryDetailsDbRecord` and its associated table (`LabratoryDetails`) use the misspelled word *“Labratory”* instead of *“Laboratory”*. This is likely intentional for legacy consistency but may cause confusion.
- **Redundant name fields**: Each interface includes both a generic `Name` and a more specific name field (e.g., `TestEngineerName`, `CustomerName`, `LabratoryName`). The distinction between these fields is not documented—consumers must infer semantics from naming.
- **Missing nullability annotations**: While `[Column]` attributes specify column names, they do not indicate whether columns allow `NULL`. For example, `LastModifiedBy` is mapped but may be nullable in the database despite the lack of `[Required]`.
- **Concurrency handling**: The `Version` field is present but its semantics (e.g., row version vs. manual increment) are not specified in the interface.
- **No validation attributes**: Despite using `System.ComponentModel.DataAnnotations`, no `[Required]`, `[StringLength]`, or `[DataType]` attributes are applied beyond `[Key]` and `[Column]`, so consumers cannot rely on metadata-driven validation.
- **No inheritance or shared base interface**: Despite overlapping fields (e.g., `Name`, `LocalOnly`, `LastModified`, `LastModifiedBy`, `Version`), there is no common interface or abstract class—this may lead to duplication in data access or mapping logic.
- **None identified from source alone.**