private async Task <bool> IsFormatSupportedAsync(ResourceFormat resourceFormat) { if (_supportedFormats.TryGetValue(resourceFormat, out var isSupported)) { return(isSupported); } ResourceElement typedStatement = await _conformanceProvider.GetCapabilityStatementOnStartup(); IEnumerable <string> formats = typedStatement.Select("CapabilityStatement.format").Select(x => (string)x.Value); return(_supportedFormats.GetOrAdd(resourceFormat, format => { switch (resourceFormat) { case ResourceFormat.Json: return formats.Any(f => f.Contains("json", StringComparison.Ordinal)); case ResourceFormat.Xml: return formats.Any(f => f.Contains("xml", StringComparison.Ordinal)); default: return false; } })); }
public async Task <bool> IsPatchFormatSupportedAsync(string format) { if (_supportedPatchFormats.TryGetValue(format, out var isSupported)) { return(isSupported); } ResourceElement typedStatement = await _conformanceProvider.GetCapabilityStatementOnStartup(); IEnumerable <string> formats = typedStatement.Select("CapabilityStatement.patchFormat").Select(x => (string)x.Value); return(_supportedPatchFormats.GetOrAdd(format, format => { return formats.Any(f => format.Contains(f, StringComparison.Ordinal)); })); }