65 lines
4.8 KiB
Markdown
65 lines
4.8 KiB
Markdown
|
|
---
|
|||
|
|
source_files:
|
|||
|
|
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Properties/AssemblyInfo.cs
|
|||
|
|
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Properties/Settings.Designer.cs
|
|||
|
|
generated_at: "2026-04-16T04:30:25.113253+00:00"
|
|||
|
|
model: "Qwen/Qwen3-Coder-Next-FP8"
|
|||
|
|
schema_version: 1
|
|||
|
|
sha256: "ae1921064164fa41"
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
# Properties
|
|||
|
|
|
|||
|
|
## Documentation: DatabaseImport Module
|
|||
|
|
|
|||
|
|
### 1. Purpose
|
|||
|
|
This module (`DatabaseImport`) is a .NET assembly responsible for managing database import functionality within the DataPRO system. It provides configuration-driven behavior for import operations, including specifying where downloaded data is stored (`DownloadFolder`), controlling whether automatic arming of systems is permitted (`AllowAutoArm`), defining calibration warning thresholds (`CalWarningPeriodDays`), selecting the target database type (`DBType`), and enforcing compatibility requirements for ISO export generation (`RequireXCrashCompatibilityForISOExports`). Its role is to encapsulate and expose application-level settings used during database import workflows.
|
|||
|
|
|
|||
|
|
### 2. Public Interface
|
|||
|
|
The module exposes only one public type:
|
|||
|
|
- **`DatabaseImport.Properties.Settings`** (internal sealed class, but accessible via `Settings.Default` static property)
|
|||
|
|
A strongly-typed settings class derived from `System.Configuration.ApplicationSettingsBase`. Provides read/write access to application and user-scoped configuration values.
|
|||
|
|
|
|||
|
|
- **`public static Settings Default { get; }`**
|
|||
|
|
Returns the singleton instance of the `Settings` class, synchronized for thread safety.
|
|||
|
|
|
|||
|
|
- **`public string DownloadFolder { get; }`**
|
|||
|
|
*Application-scoped*. Returns the default path for downloaded data files. Default value: `"..\Data"`.
|
|||
|
|
|
|||
|
|
- **`public bool AllowAutoArm { get; }`**
|
|||
|
|
*Application-scoped*. Controls whether automatic arming (likely of measurement or acquisition systems) is permitted during import. Default value: `false`.
|
|||
|
|
|
|||
|
|
- **`public int CalWarningPeriodDays { get; set; }`**
|
|||
|
|
*User-scoped*. Specifies the number of days before calibration expiry at which a warning should be issued. Default value: `7`. Supports runtime modification (setter present).
|
|||
|
|
|
|||
|
|
- **`public int DBType { get; }`**
|
|||
|
|
*Application-scoped*. Encodes the type of database to target for import (e.g., enum-like integer). Default value: `1`. Interpretation of values is not defined in this file.
|
|||
|
|
|
|||
|
|
- **`public bool RequireXCrashCompatibilityForISOExports { get; }`**
|
|||
|
|
*Application-scoped*. Enforces compatibility with "XCrash" format when exporting ISO data. Default value: `true`.
|
|||
|
|
|
|||
|
|
### 3. Invariants
|
|||
|
|
- `Settings.Default` is a singleton and thread-safe (via `ApplicationSettingsBase.Synchronized`).
|
|||
|
|
- `DownloadFolder`, `AllowAutoArm`, `DBType`, and `RequireXCrashCompatibilityForISOExports` are *application-scoped* and immutable at runtime (read-only properties).
|
|||
|
|
- `CalWarningPeriodDays` is *user-scoped* and mutable at runtime (has a public setter).
|
|||
|
|
- All settings have explicitly defined default values via `[DefaultSettingValueAttribute]`.
|
|||
|
|
- No runtime validation of setting values (e.g., `DBType` values, `CalWarningPeriodDays` sign) is present in this file.
|
|||
|
|
|
|||
|
|
### 4. Dependencies
|
|||
|
|
- **Dependencies of this module**:
|
|||
|
|
- `System.Configuration` (for `ApplicationSettingsBase`, attributes like `ApplicationScopedSettingAttribute`, `UserScopedSettingAttribute`)
|
|||
|
|
- `System.Runtime.CompilerServices`, `System.CodeDom.Compiler`, `System.Diagnostics` (for attributes)
|
|||
|
|
- `System` (core types)
|
|||
|
|
- **Depended upon by**:
|
|||
|
|
- Other modules in the `DataPRO.Modules.DatabaseImporter` solution (e.g., import logic that consumes `Settings.Default.DownloadFolder`, `Settings.Default.DBType`, etc.).
|
|||
|
|
- UI layers (e.g., settings dialogs) that bind to `Settings.Default` for user-modifiable values like `CalWarningPeriodDays`.
|
|||
|
|
|
|||
|
|
### 5. Gotchas
|
|||
|
|
- **`DBType` semantics are opaque**: The integer value has no documented meaning (e.g., 1 = SQLite? SQL Server? Custom DB?). Consumers must infer or document externally.
|
|||
|
|
- **`DownloadFolder` is relative**: Path `"..\Data"` is relative to the application’s base directory; behavior may vary if the app is launched from a different working directory.
|
|||
|
|
- **No schema versioning**: Settings are not versioned or migrated; changing defaults (e.g., `DBType`) may break existing user configurations if not handled by a higher-level updater.
|
|||
|
|
- **`AllowAutoArm` default is `false`**: If auto-arm is expected to be enabled by default in production, this may indicate legacy or safety-conscious design.
|
|||
|
|
- **User-scoped settings persist per-user**: Changes to `CalWarningPeriodDays` are saved per-user profile; may cause inconsistent behavior in shared environments (e.g., terminals, kiosks).
|
|||
|
|
- **Auto-generated file**: `Settings.Designer.cs` is generated by Visual Studio’s Settings Designer; manual edits risk being overwritten.
|
|||
|
|
|
|||
|
|
None identified beyond the above.
|