/// <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); }
/// <summary> /// Initializes a new instance of the <see cref="ArtefactRetrieverEngine{T}"/> 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 ArtefactRetrieverEngine(Database mappingStoreDb, string orderBy = null) { if (mappingStoreDb == null) { throw new ArgumentNullException("mappingStoreDb"); } this._mappingStoreDb = mappingStoreDb; this._artefactCommandBuilder = new ArtefactCommandBuilder(this._mappingStoreDb); var tableInfoBuilder = new TableInfoBuilder(); var tableInfo = tableInfoBuilder.Build(typeof(T)); if (tableInfo != null) { var latestArtefactSqlBuilder = new ArtefactSqlBuilder(orderBy, VersionQueryType.Latest); var artefactSqlBuilder = new ArtefactSqlBuilder(orderBy); this._sqlQueryInfo = artefactSqlBuilder.Build(tableInfo); this._sqlQueryInfoLatest = latestArtefactSqlBuilder.Build(tableInfo); this._artefactParentsSqlBuilder = new ArtefactParentsSqlBuilder(tableInfo); this._maintainableAnnotationRetrieverEngine = new MaintainableAnnotationRetrieverEngine(mappingStoreDb, tableInfo); } }
/// <summary> /// Initializes a new instance of the <see cref="ArtefactSqlQuery"/> class. /// </summary> /// <param name="tableInfo"> /// The table Info. /// </param> /// <param name="maintainableRef"> /// The maintainable reference which may contain ID, AGENCY ID and/or VERSION /// </param> public ArtefactSqlQuery(TableInfo tableInfo, IMaintainableRefObject maintainableRef) : this(_artefactSqlBuilder.Build(tableInfo), maintainableRef) { }