Interface IContentService
public interface IContentService
Methods
ClearCacheAsync()
Task ClearCacheAsync()
Returns
GetContentAsync(string, string, Guid, ContentFormat?, string, IReadOnlyDictionary<string, string>)
Task<(string Value, bool Success)> GetContentAsync(string key, string defaultValue, Guid languageKey, ContentFormat? contentType, string application = null, IReadOnlyDictionary<string, string> translations = null)
Parameters
keystringdefaultValuestringlanguageKeyGuidcontentTypeContentFormat?applicationstringtranslationsIReadOnlyDictionary<string, string>
Returns
GetContentResultAsync(string, string, Guid, ContentFormat?, string, IReadOnlyDictionary<string, string>)
As GetContentAsync(string, string, Guid, ContentFormat?, string, IReadOnlyDictionary<string, string>), but also reports where the value came from (ContentSource) — server, cache, stale cache or fallback default.
Task<ContentResult> GetContentResultAsync(string key, string defaultValue, Guid languageKey, ContentFormat? contentType, string application = null, IReadOnlyDictionary<string, string> translations = null)
Parameters
keystringdefaultValuestringlanguageKeyGuidcontentTypeContentFormat?applicationstringtranslationsIReadOnlyDictionary<string, string>
Returns
Remarks
A default implementation is provided so adding this member does not break existing implementers of this public interface. It delegates to GetContentAsync(string, string, Guid, ContentFormat?, string, IReadOnlyDictionary<string, string>) and reports Unknown rather than inventing a provenance it cannot know. The built-in implementation overrides it with the real source.
GetManyContentAsync(IReadOnlyCollection<ContentRequest>, Guid, ContentFormat?, string)
Resolve many keys at once, returning a dictionary keyed by content key with the caller's own default filled in for anything unresolved.
Task<IReadOnlyDictionary<string, string>> GetManyContentAsync(IReadOnlyCollection<ContentRequest> requests, Guid languageKey, ContentFormat? contentType, string application = null)
Parameters
requestsIReadOnlyCollection<ContentRequest>languageKeyGuidcontentTypeContentFormat?applicationstring
Returns
Remarks
The warm-up path has always fetched in bulk; callers had no equivalent, so a view declaring
many keys resolved them one at a time. One consuming dialog has 42 call sites plus four
option builders that await once per enum value inside a foreach — around 70
sequential calls to open one dialog (Toolkit issue #183).
The per-key path remains for one-offs. This is an addition, not a replacement.
A default implementation is provided so adding this member does not break existing implementers of this public interface; it simply loops the single-key path, which is what a caller would otherwise have written by hand.
SetContentAsync(string, string, Guid, ContentFormat, string)
Task SetContentAsync(string key, string value, Guid languageKey, ContentFormat contentType, string application = null)
Parameters
keystringvaluestringlanguageKeyGuidcontentTypeContentFormatapplicationstring