56 lines
2.0 KiB
Markdown
56 lines
2.0 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/SettingsDB/Setting.cs
|
||
|
|
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/SettingsDB/GlobalSetting.cs
|
||
|
|
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/SettingsDB/SettingsDB.cs
|
||
|
|
generated_at: "2026-04-17T15:55:29.267823+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "08773b944623c2c5"
|
||
|
|
---
|
||
|
|
|
||
|
|
# SettingsDB Module Documentation
|
||
|
|
|
||
|
|
## 1. Purpose
|
||
|
|
|
||
|
|
This module provides a singleton-based mechanism for storing and retrieving application settings from a database. It implements a cached settings layer where global configuration values are read from the database on first access and cached in memory. The module is part of a legacy database version (Version57) and supports string, integer, and boolean setting types. It assumes an existing database connection has been established via `DbOperations`.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 2. Public Interface
|
||
|
|
|
||
|
|
### `Setting` (Abstract Base Class)
|
||
|
|
|
||
|
|
**Constructor:**
|
||
|
|
```csharp
|
||
|
|
public Setting(string id, PropertyTypes type, string defaultPropertyValue, string userId)
|
||
|
|
```
|
||
|
|
Initializes a new setting with the given ID, type, default value, and user ID. Calls `GetPropertyValue(defaultPropertyValue)` during construction.
|
||
|
|
|
||
|
|
**Properties:**
|
||
|
|
- `public string PropertyId` — Read-only accessor for the setting's string identifier.
|
||
|
|
- `public string PropertyValue` — Read-only accessor for the setting's string value.
|
||
|
|
|
||
|
|
**Enum:**
|
||
|
|
```csharp
|
||
|
|
public enum PropertyTypes
|
||
|
|
{
|
||
|
|
User = 1 << 0, // Value: 1
|
||
|
|
Global = 1 << 1 // Value: 2
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
**Methods:**
|
||
|
|
- `protected abstract void GetPropertyValue(string defaultValue)` — Abstract method that derived classes must implement to retrieve the property value (typically from database).
|
||
|
|
- `public void SetValue(string value)` — Sets `_propertyValue` to the provided string.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### `GlobalSetting` (Concrete Class)
|
||
|
|
|
||
|
|
Inherits from `Setting`.
|
||
|
|
|
||
|
|
**Constructor:**
|
||
|
|
```csharp
|
||
|
|
public GlobalSetting(string id, string defaultPropertyValue)
|
||
|
|
``
|