示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataflowRetrievalEngine"/> class.
        /// </summary>
        /// <param name="mappingStoreDb">
        /// The mapping store DB.
        /// </param>
        /// <param name="filter">
        /// The filter. (Optional defaults to <see cref="DataflowFilter.Production"/>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="mappingStoreDb"/> is null.
        /// </exception>
        public DataflowRetrievalEngine(Database mappingStoreDb, DataflowFilter filter = DataflowFilter.Production)
            : base(mappingStoreDb)
        {
            this._artefactCommandBuilder = new DataflowCommandBuilder(mappingStoreDb, filter);
            var sqlQueryBuilder = new ReferencedSqlQueryBuilder(this.MappingStoreDb, null);

            this._keyFamilyRefQuery          = sqlQueryBuilder.Build(DataflowConstant.KeyFamilyRefQueryFormat);
            this._keyFamilyRefCommandBuilder = new ItemCommandBuilder(this.MappingStoreDb);
            ArtefactSqlBuilder dataflowBuilder;
            ArtefactSqlBuilder latestBuilder;

            switch (filter)
            {
            case DataflowFilter.Any:
                dataflowBuilder = new ArtefactSqlBuilder();
                latestBuilder   = new ArtefactSqlBuilder(null, VersionQueryType.Latest);
                break;

            case DataflowFilter.Production:
                dataflowBuilder = new ArtefactSqlBuilder(null, VersionQueryType.All, DataflowConstant.ProductionWhereLatestClause);
                latestBuilder   = new ArtefactSqlBuilder(null, VersionQueryType.Latest, DataflowConstant.ProductionWhereLatestClause);
                break;

            default:
                throw new ArgumentOutOfRangeException("filter");
            }

            this._sqlQueryInfo       = dataflowBuilder.Build(DataflowConstant.TableInfo);
            this._sqlQueryInfoLatest = latestBuilder.Build(DataflowConstant.TableInfo);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DsdRetrievalEngine"/> class.
        ///     Initializes a new instance of the <see cref="DataflowRetrievalEngine"/> class.
        /// </summary>
        /// <param name="mappingStoreDb">
        /// The mapping store DB.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="mappingStoreDb"/> is null.
        /// </exception>
        public DsdRetrievalEngine(Database mappingStoreDb)
            : base(mappingStoreDb)
        {
            var sqlQueryBuilder = new ReferencedSqlQueryBuilder(this.MappingStoreDb, null);

            this._attributeGroupQueryInfo    = sqlQueryBuilder.Build(DsdConstant.AttributeAttachmentGroupQueryFormat);
            this._attributeMeasureQueryInfo  = sqlQueryBuilder.Build(DsdConstant.AttributeAttachmentMeasureQueryFormat);
            this._groupQueryInfo             = sqlQueryBuilder.Build(DsdConstant.GroupQueryFormat);
            this._attributeDimensionRefsInfo = sqlQueryBuilder.Build(DsdConstant.AttributeDimensionFormat);
            this._componentQueryInfo         = sqlQueryBuilder.Build(DsdConstant.ComponentQueryFormat);
            this._componentQueryInfo.OrderBy = DsdConstant.ComponentOrderBy;
            this._commandBuilder             = new ItemCommandBuilder(this.MappingStoreDb);

            this._componentAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(
                mappingStoreDb,
                new ItemTableInfo(SdmxStructureEnumType.Component)
            {
                ForeignKey = "DSD_ID", PrimaryKey = "COMP_ID", Table = "COMPONENT"
            });

            this._groupAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(
                mappingStoreDb,
                new ItemTableInfo(SdmxStructureEnumType.Group)
            {
                ForeignKey = "DSD_ID", PrimaryKey = "GR_ID", Table = "DSD_GROUP"
            });
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ItemSchemeRetrieverEngine{TMaintaible,TItem}"/> class.
        /// </summary>
        /// <param name="mappingStoreDb">
        /// The mapping store DB.
        /// </param>
        /// <param name="orderBy">
        /// The order By.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="mappingStoreDb"/> is null
        /// </exception>
        protected ItemSchemeRetrieverEngine(Database mappingStoreDb, string orderBy = null)
            : base(mappingStoreDb, orderBy)
        {
            this._itemCommandBuilder = new ItemCommandBuilder(mappingStoreDb);
            var       itemTableInfoBuilder = new ItemTableInfoBuilder();
            TableInfo tableInfo            = new TableInfoBuilder().Build(typeof(TMaintaible));
            var       itemTableInfo        = itemTableInfoBuilder.Build(tableInfo.StructureType);
            var       itemSqlQueryBuilder  = new ItemSqlQueryBuilder(mappingStoreDb, null);

            this._itemSqlQueryInfo = itemSqlQueryBuilder.Build(itemTableInfo);

            this._identifiableAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(mappingStoreDb, itemTableInfo);
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HierarchicalCodeListRetrievealEngine"/> class.
        /// </summary>
        /// <param name="mappingStoreDb">
        /// The mapping store DB.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="mappingStoreDb"/> is null.
        /// </exception>
        public HierarchicalCodeListRetrievealEngine(Database mappingStoreDb)
            : base(mappingStoreDb)
        {
            var sqlQueryBuilder = new ReferencedSqlQueryBuilder(this.MappingStoreDb, null);

            this._hierarchyQueryInfo   = sqlQueryBuilder.Build(HclConstant.HierarchyQueryFormat);
            this._codelistRefQueryInfo = sqlQueryBuilder.Build(HclConstant.CodelistRefQueryFormat);
            this._codeRefQueryInfo     = sqlQueryBuilder.Build(HclConstant.CodeRefQueryFormat);
            this._levelQueryInfo       = sqlQueryBuilder.Build(HclConstant.LevelQueryFormat);
            this._itemCommandBuilder   = new ItemCommandBuilder(this.MappingStoreDb);

            this._hierarchalCodeAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(mappingStoreDb, new ItemTableInfo(SdmxStructureEnumType.HierarchicalCode)
            {
                ForeignKey = "H_ID", PrimaryKey = "HCODE_ID", Table = "HCL_CODE"
            });
            this._levelAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(mappingStoreDb, new ItemTableInfo(SdmxStructureEnumType.HierarchicalCode)
            {
                ForeignKey = "H_ID", PrimaryKey = "LEVEL_ID", Table = "HLEVEL"
            });
            this._hierarchyAnnotationRetrieverEngine = new IdentifiableAnnotationRetrieverEngine(mappingStoreDb, new ItemTableInfo(SdmxStructureEnumType.HierarchicalCode)
            {
                ForeignKey = "HCL_ID", PrimaryKey = "H_ID", Table = "HIERARCHY"
            });
        }