76 lines
2.6 KiB
Markdown
76 lines
2.6 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- Common/DTS.CommonCore/Base/Model/BaseModel.cs
|
||
|
|
generated_at: "2026-04-17T16:40:06.536199+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "4cc2728963c0ba1e"
|
||
|
|
---
|
||
|
|
|
||
|
|
# Documentation: BaseModel.cs
|
||
|
|
|
||
|
|
## 1. Purpose
|
||
|
|
|
||
|
|
This module provides `BaseModel<TModel>`, an abstract generic base class designed to wrap domain model objects. It serves as a foundation for creating model wrapper classes that require property change notification capabilities and persistence state tracking. The class acts as a bridge between raw data models and UI/view-layer components in the DTS system.
|
||
|
|
|
||
|
|
## 2. Public Interface
|
||
|
|
|
||
|
|
### `BaseModel<TModel>` (Class)
|
||
|
|
**Signature:**
|
||
|
|
```csharp
|
||
|
|
public abstract class BaseModel<TModel> : BasePropertyChanged, IBaseModel
|
||
|
|
where TModel : class
|
||
|
|
```
|
||
|
|
|
||
|
|
**Description:** Abstract generic base class for model wrappers. Inherits from `BasePropertyChanged` and implements `IBaseModel`. The generic type parameter `TModel` is constrained to reference types only.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### `Model` (Property)
|
||
|
|
**Signature:**
|
||
|
|
```csharp
|
||
|
|
public TModel Model { get; set; }
|
||
|
|
```
|
||
|
|
|
||
|
|
**Description:** Gets or sets the wrapped model object. No validation or null-checking is performed in the setter.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### `BaseModel()` (Constructor)
|
||
|
|
**Signature:**
|
||
|
|
```csharp
|
||
|
|
public BaseModel()
|
||
|
|
```
|
||
|
|
|
||
|
|
**Description:** Public parameterless constructor. Creates a new instance with default property values.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### `IsSaved` (Property)
|
||
|
|
**Signature:**
|
||
|
|
```csharp
|
||
|
|
public bool IsSaved { get; private set; }
|
||
|
|
```
|
||
|
|
|
||
|
|
**Description:** Gets a boolean indicating whether the model has been saved. The setter is private.
|
||
|
|
|
||
|
|
## 3. Invariants
|
||
|
|
|
||
|
|
- **Generic Type Constraint:** `TModel` must be a reference type (`class` constraint).
|
||
|
|
- **Inheritance Chain:** All `BaseModel<TModel>` instances are also `BasePropertyChanged` instances and implement `IBaseModel`.
|
||
|
|
- **Constructor Accessibility:** Despite being abstract, the class exposes a public constructor.
|
||
|
|
|
||
|
|
## 4. Dependencies
|
||
|
|
|
||
|
|
### This module depends on:
|
||
|
|
- `BasePropertyChanged` — Base class providing property change notification (likely implements `INotifyPropertyChanged`).
|
||
|
|
- `IBaseModel` — Interface contract for model objects.
|
||
|
|
|
||
|
|
### Dependents:
|
||
|
|
- Cannot be determined from this source file alone. Any class that wraps a model object and needs property change notification would inherit from this base class.
|
||
|
|
|
||
|
|
## 5. Gotchas
|
||
|
|
|
||
|
|
- **Namespace Mismatch:** The file is located at `Common/DTS.CommonCore/Base/Model/BaseModel.cs` but the namespace is declared as `DTS.Common.Base`. The `// ReSharper disable CheckNamespace` directive suppresses the IDE warning for this mismatch.
|
||
|
|
|
||
|
|
- **Public Constructor in Abstract Class:** The class is abstract yet declares a public constructor. While legal
|