/// <summary> /// Returns concept scheme version. It tries to detect various conventions /// </summary> /// <param name="primaryMeasure"> /// The primaryMeasure. /// </param> /// <returns> /// The concept scheme version; otherwise null /// </returns> private static string GetConceptSchemeVersion(CrossSectionalMeasureType primaryMeasure) { if (!string.IsNullOrWhiteSpace(primaryMeasure.conceptVersion)) { return primaryMeasure.conceptVersion; } if (!string.IsNullOrWhiteSpace(primaryMeasure.ConceptSchemeVersionEstat)) { return primaryMeasure.ConceptSchemeVersionEstat; } var extDimension = primaryMeasure as Org.Sdmx.Resources.SdmxMl.Schemas.V20.extension.structure.CrossSectionalMeasureType; if (extDimension != null && !string.IsNullOrWhiteSpace(extDimension.conceptSchemeVersion)) { return extDimension.conceptSchemeVersion; } return null; }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="CrossSectionalMeasureCore"/> class. /// </summary> /// <param name="createdFrom"> /// The created from. /// </param> /// <param name="parent"> /// The parent. /// </param> /// <exception cref="SdmxSemmanticException"> /// Throws Validate exception. /// </exception> public CrossSectionalMeasureCore(CrossSectionalMeasureType createdFrom, IIdentifiableObject parent) : base( createdFrom, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.CrossSectionalMeasure), createdFrom.Annotations, createdFrom.TextFormat, createdFrom.codelistAgency, createdFrom.codelist, createdFrom.codelistVersion, createdFrom.conceptSchemeAgency, createdFrom.conceptSchemeRef, GetConceptSchemeVersion(createdFrom), createdFrom.conceptAgency, createdFrom.conceptRef, parent) { this.measureDimension = createdFrom.measureDimension; this.code = createdFrom.code; try { this.Validate(); } catch (SdmxSemmanticException ex) { throw new SdmxSemmanticException(ex, ExceptionCode.ObjectStructureConstructionError, this.Urn); } catch (Exception th) { throw new SdmxException(th, ExceptionCode.ObjectStructureConstructionError, this.Urn); } }