public void PreInitialize(TableInfo target, IDataLoadEventListener listener)
        {
            TableToLoad   = target;
            _bInitialized = true;

            _dumper = new IdentifierDumper(TableToLoad);
            _dumper.CreateSTAGINGTable();

            //columns we expect to ANO
            foreach (ColumnInfo columnInfo in target.ColumnInfos)
            {
                string columnName = columnInfo.GetRuntimeName();

                if (columnInfo.ANOTable_ID != null)
                {
                    //The metadata says this column should be ANOd
                    if (!columnName.StartsWith(ANOTable.ANOPrefix))
                    {
                        throw new Exception("ColumnInfo  " + columnName + " does not start with ANO but is marked as an ANO column (ID=" + columnInfo.ID + ")");
                    }

                    //if the column is ANOGp then look for column Gp in the input columns (DataTable toProcess)
                    columnName = columnName.Substring(ANOTable.ANOPrefix.Length);
                    columnsToAnonymise.Add(columnName, new ANOTransformer(columnInfo.ANOTable));
                }
            }
        }
        public void Synchronize(ICheckNotifier notifier)
        {
            IdentifierDumper dumper = new IdentifierDumper(_tableToSync);

            dumper.Check(notifier);

            CheckForDuplicateANOVsRegularNames();

            var columnInfosWithANOTransforms = _tableToSync.ColumnInfos.Where(c => c.ANOTable_ID != null).ToArray();

            if (!columnInfosWithANOTransforms.Any())
            {
                notifier.OnCheckPerformed(
                    new CheckEventArgs(
                        "There are no ANOTables configured for this table so skipping ANOTable checking",
                        CheckResult.Success));
            }

            foreach (ColumnInfo columnInfoWithANOTransform in columnInfosWithANOTransforms)
            {
                ANOTable anoTable = columnInfoWithANOTransform.ANOTable;
                anoTable.Check(new ThrowImmediatelyCheckNotifier());

                if (!anoTable.GetRuntimeDataType(LoadStage.PostLoad).Equals(columnInfoWithANOTransform.Data_type))
                {
                    throw new ANOConfigurationException("Mismatch between anoTable.GetRuntimeDataType(LoadStage.PostLoad) = " + anoTable.GetRuntimeDataType(LoadStage.PostLoad) + " and column " + columnInfoWithANOTransform + " datatype = " + columnInfoWithANOTransform.Data_type);
                }

                notifier.OnCheckPerformed(
                    new CheckEventArgs(
                        "ANOTable " + anoTable + " has shared compatible datatype " + columnInfoWithANOTransform.Data_type + " with ColumnInfo " +
                        columnInfoWithANOTransform, CheckResult.Success));
            }
        }
 public IdentifierDumperSynchronizer(IdentifierDumper dumper, ExternalDatabaseServer dump)
 {
     _parent = dumper;
     _dump   = dump;
 }