4.8 KiB
4.8 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T03:43:57.997232+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | d8e42dfbcf704680 |
Properties
Documentation: DTS.Common.Service.Properties Module
1. Purpose
This module provides strongly-typed, auto-generated application and user settings for the DTS.Common.Service assembly via .NET’s ApplicationSettingsBase. It enables centralized, type-safe access to configuration values such as monitoring state, polling interval, and service names, which are persisted at application and user scopes respectively. It exists to decouple runtime configuration from code logic and to support design-time tooling (e.g., Visual Studio Settings Designer) for managing settings.
2. Public Interface
The module exposes a single internal sealed class: DTS.Common.Service.Properties.Settings.
Settings.Default (static property)
public static Settings Default { get; }
- Returns the singleton instance of
Settings, thread-safe due toSynchronized()wrapping. - Used to access all settings properties.
Settings.Monitoring (read-only application-scoped property)
public bool Monitoring { get; }
- Default value:
false. - Indicates whether monitoring is enabled for the service.
- Application-scoped → read-only at runtime; value is fixed at compile time.
Settings.Interval (read-only application-scoped property)
public int Interval { get; }
- Default value:
60000(milliseconds). - Represents the polling or monitoring interval.
- Application-scoped → immutable at runtime.
Settings.ServiceName (read-only application-scoped property)
public string ServiceName { get; }
- Default value:
"DTS Common Service". - The canonical name of the service (e.g., for registration or logging).
- Application-scoped.
Settings.Service (read-write user-scoped property)
public string Service { get; set; }
- Default value:
"DTS Service". - User-scoped → can be modified at runtime and persisted per-user.
- Intended for customization (e.g., instance-specific service name overrides).
3. Invariants
Settings.Defaultis guaranteed to be non-null and thread-safe (viaSynchronized()).- Application-scoped settings (
Monitoring,Interval,ServiceName) are immutable at runtime; their values are fixed by the compiled.configfile or designer defaults. - User-scoped setting
Servicemay be modified at runtime, but changes are not persisted automatically—explicitSave()call (onSettings.Default) is required to persist user changes. - All settings values are validated only by their declared types (e.g.,
bool,int,string); no additional runtime validation is present in this module.
4. Dependencies
Dependencies of this module:
System.Configuration(forApplicationSettingsBase, attributes like[ApplicationScopedSettingAttribute],[UserScopedSettingAttribute])System.Runtime.CompilerServices(for[CompilerGeneratedAttribute])System.CodeDom.Compiler(for[GeneratedCodeAttribute])System.Diagnostics(for[DebuggerNonUserCodeAttribute])
Dependencies on this module:
- The broader
DTS.Common.Serviceassembly (and likely its Windows Service entry point) consumesSettings.Defaultto configure behavior (e.g.,Settings.Monitoring,Settings.Interval). - No other modules in this repository are visible as consumers, but the assembly is intended for reuse (per namespace
DTS.Common.Service).
5. Gotchas
- Settings are not auto-saved: User-scoped setting
Servicerequires explicitSettings.Default.Save()to persist changes across sessions. Omitting this will cause changes to be lost on restart. - Application-scoped settings are compile-time constants: Modifying values in
App.configafter compilation will not affectMonitoring,Interval, orServiceNameunless the assembly is recompiled. These values are baked into the generatedSettings.Designer.cs. - Thread-safety is limited: While
Synchronized()ensures thread-safe access to the singleton instance, concurrent writes to user-scoped settings (e.g.,Settings.Default.Service = "...") are not protected—external synchronization is required if multi-threaded mutation occurs. - Auto-generated code: The
Settings.Designer.csfile is marked with<auto-generated>and warns that manual edits will be lost on regeneration (e.g., after re-saving settings in Visual Studio). - No versioning or migration logic: No
SettingsUpgradeRequiredor migration handling is present; changes to settings structure may require manual migration or reset.
None identified beyond the above.