Files
DP44/docs/ai/Common/DTS.CommonCore/Base/Model.md
2026-04-17 14:55:32 -04:00

2.6 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.CommonCore/Base/Model/BaseModel.cs
2026-04-17T16:40:06.536199+00:00 zai-org/GLM-5-FP8 1 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:

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:

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:

public BaseModel()

Description: Public parameterless constructor. Creates a new instance with default property values.


IsSaved (Property)

Signature:

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