private void LoadGenericSearchParameters() { var genericSearchParamDefinitions = new List<ModelInfo.SearchParamDefinition> { new ModelInfo.SearchParamDefinition { Resource = "Resource", Name = "_id", Type = SearchParamType.String, Path = new string[] { "Resource.id" } } , new ModelInfo.SearchParamDefinition { Resource = "Resource", Name = "_lastUpdated", Type = SearchParamType.Date, Path = new string[] { "Resource.meta.lastUpdated" } } , new ModelInfo.SearchParamDefinition { Resource = "Resource", Name = "_profile", Type = SearchParamType.Token, Path = new string[] { "Resource.meta.profile" } } , new ModelInfo.SearchParamDefinition { Resource = "Resource", Name = "_security", Type = SearchParamType.Token, Path = new string[] { "Resource.meta.security" } } , new ModelInfo.SearchParamDefinition { Resource = "Resource", Name = "_tag", Type = SearchParamType.Token, Path = new string[] { "Resource.meta.tag" } } }; //CK: Below is how it should be, once SearchParameter has proper support for Composite parameters. //var genericSearchParameters = new List<SearchParameter> //{ // new SearchParameter { Base = "Resource", Code = "_id", Name = "_id", Type = SearchParamType.String, Xpath = "//id"} // , new SearchParameter { Base = "Resource", Code = "_lastUpdated", Name = "_lastUpdated", Type = SearchParamType.Date, Xpath = "//meta/lastUpdated"} // , new SearchParameter { Base = "Resource", Code = "_profile", Name = "_profile", Type = SearchParamType.Token, Xpath = "//meta/profile"} // , new SearchParameter { Base = "Resource", Code = "_security", Name = "_security", Type = SearchParamType.Token, Xpath = "//meta/security"} // , new SearchParameter { Base = "Resource", Code = "_tag", Name = "_tag", Type = SearchParamType.Token, Xpath = "//meta/tag"} //}; //Not implemented (yet): _query, _text, _content var genericSearchParameters = genericSearchParamDefinitions.Select(spd => createSearchParameterFromSearchParamDefinition(spd)); _searchParameters.AddRange(genericSearchParameters.Except(_searchParameters)); //We have no control over the incoming list of searchParameters (in the constructor), so these generic parameters may or may not be in there. //So we apply the Except operation to make sure these parameters are not added twice. }
private String describeTypes(Profile profile, List<Profile.TypeRefComponent> types) { if (types == null || !types.Any()) return null; if (types.Count == 1) return describeType(profile, types[0]); else { return "Choice of: " + String.Join(", ", types.Select(t => describeType(profile, t))); } }