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¶
- Call
LoadSectionforsection. - 1.1. This always runs the refresh check first: an empty global cache (or any call once the server's
lastRefreshedtimestamp has advanced, probed at most every 60 seconds) clears and reloads the whole cache —LastRefreshedis 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. - 1.2. If the (lowercased)
sectionkey is already recorded in theSectionscache,LoadSectionreturns immediately with no network call; otherwise it acquiresSectionsSemaphore, re-checksSectionsunder the lock, and only then calls the Environment API. A successful fetch with 1+ settings adds the section toSections; a successful fetch with zero settings is removed fromSectionsif present and retried on the very next call; a non-success HTTP result or a malformed response throwsEnvironmentClientExceptionout of this call. But only a nonemptysectionis ever marked loaded; a caller explicitly passing""reaches the never-marked-loaded root case and is fetched again on every call (BR-EC-13). -
Origin: Steps 1.1–1.2 are implemented in Load section and Refresh check and cache reload, and executed on behalf of this operation.
- Compute
key = GetSectionKey(section)(lowercased section name). - Filter the single global
SettingsConcurrentDictionary<string, ConfigSetting>for every entry whose key starts with"{key}.", and copy each matching entry into a newDictionary<string, string>—Sectionsitself is only aHashSet<string>of loaded section names, there is no per-section dictionary to read from directly (BR-EC-12). Whensectionis an explicit"",keyis also"", so the filter prefix is the literal string".". Ordinary root settings loaded by step 1 are stored under their bare, unprefixed key (StoreSettingInDictionaryomits the section segment entirely whensectionis 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. CallingGetSectionSettings("")therefore loads the root section into the global cache as a side effect and does not expose ordinary bare-root entries, in contrast toHasSetting, which reads the bare, unprefixed key directly by exact match;GetSettingValue, by comparison, does not read the bare root directly either — a blank/omittedsectionthere is substituted withTrackNamebefore lookup (BR-EC-11). - 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. - 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