Ejemplo n.º 1
0
        private void ForwardEngineerExtractionInformationIfAppropriate(List <ColumnInfo> added, ICheckNotifier notifier)
        {
            //Is there one Catalogue behind this dataset?
            var relatedCatalogues = _tableToSync.GetAllRelatedCatalogues();

            //if there is only one catalogue powered by this TableInfo
            if (relatedCatalogues.Length == 1)
            {
                //And there are ExtractionInformations already for ColumnInfos in this _tableToSync
                if (relatedCatalogues[0].GetAllExtractionInformation(ExtractionCategory.Any).Any(e => e.ColumnInfo != null && e.ColumnInfo.TableInfo_ID == _tableToSync.ID))
                {
                    //And user wants to create new ExtractionInformations for the newly created sync'd ColumnInfos
                    if (notifier.OnCheckPerformed(
                            new CheckEventArgs("Would you also like to make these columns Extractable in Catalogue " + relatedCatalogues[0].Name + "?", CheckResult.Warning, null,
                                               "Also make columns Extractable?")))
                    {
                        //Create CatalogueItems for the new columns
                        ForwardEngineerCatalogue c = new ForwardEngineerCatalogue(_tableToSync, added.ToArray(), true);

                        //In the Catalogue
                        c.ExecuteForwardEngineering(relatedCatalogues[0], out var cata, out var cis, out var eis);

                        //make them extractable only as internal since it is likely they could contain sensitive data if user is just used to hammering Ok on all dialogues
                        foreach (var e in eis)
                        {
                            e.ExtractionCategory = ExtractionCategory.Internal;
                            e.SaveToDatabase();
                        }

                        ChangedCatalogues.Add(relatedCatalogues[0]);
                    }
                }
            }
        }