コード例 #1
0
        private IEnumerable <SearchParameter> BuildSearchParameterDefinition(
            ILookup <string, SearchParameter> searchParametersLookup,
            string resourceType)
        {
            if (_resourceTypeDictionary.TryGetValue(resourceType, out IDictionary <string, SearchParameter> cachedSearchParameters))
            {
                return(cachedSearchParameters.Values);
            }

            IEnumerable <SearchParameter> results = Enumerable.Empty <SearchParameter>();

            Type type = ModelInfoProvider.GetTypeForFhirType(resourceType);

            Debug.Assert(type != null, "The type should not be null.");

            string baseType = ModelInfo.GetFhirTypeNameForType(type.BaseType);

            if (baseType != null && Enum.TryParse(baseType, out ResourceType baseResourceType))
            {
                results = BuildSearchParameterDefinition(searchParametersLookup, baseType);
            }

            Debug.Assert(results != null, "The results should not be null.");

            results = results.Concat(searchParametersLookup[resourceType]);

            Dictionary <string, SearchParameter> searchParameterDictionary = results.ToDictionary(
                r => r.Name,
                r => r,
                StringComparer.Ordinal);

            _resourceTypeDictionary.Add(resourceType, searchParameterDictionary);

            return(searchParameterDictionary.Values);
        }
コード例 #2
0
 public static Type ToResourceModelType(this ResourceElement resourceType)
 {
     return(ModelInfoProvider.GetTypeForFhirType(resourceType.InstanceType));
 }
コード例 #3
0
 public static Type ToResourceModelType(this ResourceElement resourceType)
 {
     EnsureArg.IsNotNull(resourceType, nameof(resourceType));
     return(ModelInfoProvider.GetTypeForFhirType(resourceType.InstanceType));
 }