Esempio n. 1
0
        /// <summary>
        /// Open a query mapping
        /// </summary>
        private static void OpenMapping(Stream stream)
        {
            XmlSerializer xsz = XmlModelSerializerFactory.Current.CreateSerializer(typeof(QueryParameterMap));

            if (s_map == null)
            {
                s_map = xsz.Deserialize(stream) as QueryParameterMap;
            }
            else
            {
                // Merge
                var map = xsz.Deserialize(stream) as QueryParameterMap;
                s_map.Merge(map);
            }

            s_default = s_map.Map.FirstOrDefault(o => o.SourceType == typeof(ResourceBase));
        }
Esempio n. 2
0
        /// <summary>
        /// Merges two query parameter maps together
        /// </summary>
        public void Merge(QueryParameterMap map)
        {
            foreach (var itm in map.Map)
            {
                var myMapping = this.Map.FirstOrDefault(p => p.SourceType == itm.SourceType);

                // I have a local mapping
                if (myMapping != null)
                {
                    // Remove any overridden mappings
                    myMapping.Map.RemoveAll(o => itm.Map.Any(i => i.FhirName == o.FhirName));
                    // Add overridden mappings
                    myMapping.Map.AddRange(itm.Map);
                }
                else // we just add
                {
                    this.Map.Add(itm);
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Merge parameter configuration
 /// </summary>
 public static void MergeParamConfig(QueryParameterMap newMap)
 {
     s_map.Merge(newMap);
 }