public void CreateTable(Action <ITableInfoBuilder> table) { var builder = new TableInfoBuilder(); table(builder); CreateTable(builder.Build()); }
/// <summary> /// Initializes static members of the <see cref="ArtefactBaseEngine"/> class. /// </summary> static ArtefactBaseEngine() { _log = LogManager.GetLogger(typeof(ArtefactBaseEngine)); _localisedStringInsertEngine = new LocalisedStringInsertEngine(); _annotationInsertEngine = new AnnotationInsertEngine(); _tableInfoBuilder = new TableInfoBuilder(); _insertArtefactAnnotation = new InsertArtefactAnnotation(); }
/// <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); }
public static List <ITableInfo> CreateTableListFromConfig(DatabaseConfigurationSection config) { var tablesToAnonymize = new List <ITableInfo>(); if (config == null) { throw new ArgumentNullException("The DatabaseConfigurationSection input parameter is null."); } var dbs = config.Databases; if (dbs == null) { return(tablesToAnonymize); } var validatedDatabaseConfigs = DatabaseConfigFactory.CreateValidatedDatabaseConfigCollection(config.Databases); foreach (var dbConfig in validatedDatabaseConfigs) { var validatedTableConfigs = TableConfigFactory.CreateValidatedTableConfigCollection(dbConfig); foreach (var tableConfig in validatedTableConfigs) { try { var tableInfo = new TableInfoBuilder(dbConfig, tableConfig).Build(); tablesToAnonymize.Add(tableInfo); } catch (TableInfoException ex) { logger.Error(ex, $"The table with name {ex.TableName} with connection string {ex.ConnectionString} couldn't be anonymized. Error reason: " + $"{ex.Message}"); } catch (Exception ex) { logger.Error(ex, ex.StackTrace); } } } return(tablesToAnonymize); }
/// <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); } }