Skip to content

Get section settings

Field Value
Owner GetSectionSettings
Trigger Consumer call
Inputs section
Outputs A new, detached Dictionary<string, string> of the matching entries from the global Settings dictionary

Steps

  1. Call LoadSection for section.
  2. 1.1. This always runs the refresh check first: an empty global cache (or any call once the server's lastRefreshed timestamp has advanced, probed at most every 60 seconds) clears and reloads the whole cache — LastRefreshed is set before that reload runs, not after it completes, so a failure partway through is not guaranteed to be retried on the very next call.
  3. 1.2. If the (lowercased) section key is already recorded in the Sections cache, LoadSection returns immediately with no network call; otherwise it acquires SectionsSemaphore, re-checks Sections under the lock, and only then calls the Environment API. A successful fetch with 1+ settings adds the section to Sections; a successful fetch with zero settings is removed from Sections if present and retried on the very next call; a non-success HTTP result or a malformed response throws EnvironmentClientException out of this call. But only a nonempty section is ever marked loaded; a caller explicitly passing "" reaches the never-marked-loaded root case and is fetched again on every call (BR-EC-13).
  4. Origin: Steps 1.1–1.2 are implemented in Load section and Refresh check and cache reload, and executed on behalf of this operation.

  5. Compute key = GetSectionKey(section) (lowercased section name).
  6. Filter the single global Settings ConcurrentDictionary<string, ConfigSetting> for every entry whose key starts with "{key}.", and copy each matching entry into a new Dictionary<string, string> — Sections itself is only a HashSet<string> of loaded section names, there is no per-section dictionary to read from directly (BR-EC-12). When section is an explicit "", key is also "", so the filter prefix is the literal string ".". Ordinary root settings loaded by step 1 are stored under their bare, unprefixed key (StoreSettingInDictionary omits the section segment entirely when section is empty), so those ordinary entries do not start with "." and are excluded from the bulk output. This is a prefix-match exclusion, not a guarantee that every possible stored key is excluded: the global dictionary holds every loaded setting regardless of originating section, so a key that itself happens to begin with a literal . character (nothing in the source forbids such a key) would still match the filter and be returned. Calling GetSectionSettings("") therefore loads the root section into the global cache as a side effect and does not expose ordinary bare-root entries, in contrast to HasSetting, which reads the bare, unprefixed key directly by exact match; GetSettingValue, by comparison, does not read the bare root directly either — a blank/omitted section there is substituted with TrackName before lookup (BR-EC-11).
  7. The returned dictionary's keys retain the full "{section}.{key}" prefix (they are not stripped back down to the bare key), and it is a freshly allocated copy — mutating it has no effect on the client's internal cache. If no keys match the prefix, an empty dictionary is returned.
  8. Developer override lookup is not consulted by this bulk read; only Get setting value applies developer overrides.

Process flow

flowchart TD
    A[GetSectionSettings section] --> B[Load section]
    B --> C["key = GetSectionKey(section)"]
    C --> D["Filter global Settings dictionary<br>by prefix key."]
    D --> E["Copy matches into a new DictionaryOfStringString<br>(keys keep the section.key prefix)"]
    E --> F[Return the detached copy]

Sources

  • src/SAIF.NetCore.EnvironmentClient/SAIF.NetCore.EnvironmentClient/SAIF.NetCore.EnvironmentClient/BaseEnvironmentClient.cs