public ComponentMap(StructureMessage message) { Map(o => ConceptRef.Create(o.Concept)).ToAttributeGroup("conceptRef") .Set(v => _component = Create(GetConcept(message, v))) .GroupTypeMap(new ConceptRefMap()); Map(o => TempCodelistRef.Create(o.CodeList)).ToAttributeGroup("codelist") .Set(v => _component.CodeList = GetCodeList(message, v)) .GroupTypeMap(new TempCodelistRefMap()); Map(o => GetTextFormat(o)).ToElement("TextFormat", false) .Set(v => SetTextFormat(v)) .ClassMap(() => new TextFormatMap()); }
Concept GetConcept(StructureMessage message, ConceptRef v) { var concept = message.GetConcept(v.SchemeRef.Id, v.SchemeRef.AgencyId, v.SchemeRef.Version, v.Id, v.AgencyId, v.Version); if (concept == null || concept.Count() == 0) { SignalError("Concept not found: conceptSchemeId='{0}',conceptSchemeAgencyId='{1}',conceptSchemeVersion='{2}, conceptId='{3}',concpetAgencyId='{4}',conceptVersion='{5}'. Concepts thar are referenced by a key family must exist in the same file of the key family.", v.SchemeRef.Id, v.SchemeRef.AgencyId, v.SchemeRef.Version, v.Id, v.AgencyId, v.Version); return(null); } if (concept.Count() > 1) { SignalError("Duplicate Concepts found: conceptSchemeId='{0}',conceptSchemeAgencyId='{1}',conceptSchemeVersion='{2}, conceptId='{3}',concpetAgencyId='{4}',conceptVersion='{5}'. Concepts thar are referenced by a key family must exist in the same file of the key family.", v.SchemeRef.Id, v.SchemeRef.AgencyId, v.SchemeRef.Version, v.Id, v.AgencyId, v.Version); return(concept.First()); } return(concept.Single()); }