예제 #1
0
        /// <summary>
        /// Returns the <c>ITEM.ITEM_ID</c> value from Mapping Store for <paramref name="artefactId"/>
        /// </summary>
        /// <param name="state">
        /// The state.
        /// </param>
        /// <param name="sdmxStructure">
        /// The SDMX Structure.
        /// </param>
        /// <param name="artefactId">
        /// The artefact primary key. <c>ARTEFACT.ART_ID</c>.
        /// </param>
        /// <returns>
        /// The <c>ITEM.ITEM_ID</c> value from Mapping Store for <paramref name="artefactId"/>
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="state"/> is null
        /// </exception>
        /// <exception cref="ArgumentException">
        /// At <paramref name="sdmxStructure"/>, unsupported structure
        /// </exception>
        public static ItemStatusCollection GetId(DbTransactionState state, SdmxStructureEnumType sdmxStructure, long artefactId)
        {
            if (state == null)
            {
                throw new ArgumentNullException("state");
            }

            var tableInfo = _tableInfoBuilder.Build(sdmxStructure);

            if (tableInfo == null)
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.ExceptionUnsupportedStructureReferenceFormat1, sdmxStructure), "sdmxStructure");
            }

            var itemIdQueryBuilder = new ItemIdQueryBuilder(state.Database);

            var query = itemIdQueryBuilder.Build(tableInfo);

            return(new ItemStatusCollection(state.Connection.Query <ItemStatus>(
                                                query,
                                                new { id = artefactId },
                                                state.Transaction,
                                                false)));
        }
예제 #2
0
        /// <summary>
        /// Returns the <c>ITEM.ITEM_ID</c> value from Mapping Store for <paramref name="artefactId"/>
        /// </summary>
        /// <param name="state">
        /// The state.
        /// </param>
        /// <param name="sdmxStructure">
        /// The SDMX Structure.
        /// </param>
        /// <param name="artefactId">
        /// The artefact primary key. <c>ARTEFACT.ART_ID</c>.
        /// </param>
        /// <returns>
        /// The <c>ITEM.ITEM_ID</c> value from Mapping Store for <paramref name="artefactId"/>
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="state"/> is null 
        /// </exception>
        /// <exception cref="ArgumentException">
        /// At <paramref name="sdmxStructure"/>, unsupported structure
        /// </exception>
        public static ItemStatusCollection GetId(DbTransactionState state, SdmxStructureEnumType sdmxStructure, long artefactId)
        {
            if (state == null)
            {
                throw new ArgumentNullException("state");
            }

            var tableInfo = _tableInfoBuilder.Build(sdmxStructure);
            if (tableInfo == null)
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.ExceptionUnsupportedStructureReferenceFormat1, sdmxStructure), "sdmxStructure");
            }

            var itemIdQueryBuilder = new ItemIdQueryBuilder(state.Database);

            var query = itemIdQueryBuilder.Build(tableInfo);
            return new ItemStatusCollection(state.Connection.Query<ItemStatus>(
                query,
                new { id = artefactId },
                state.Transaction,
                false));
        }