Пример #1
0
        public static void ImportChildRelations(ITable srcTab, TableDefinitionDataTable destTabs)
        {
            foreach (IForeignKey srcFK in srcTab.ForeignKeys)
            {
                if (srcTab == srcFK.PrimaryTable)   // use only childrelations
                {
                    TableDefinitionRow childTab  = destTabs.FindByTableName(srcFK.ForeignTable.Name);
                    TableDefinitionRow parentTab = destTabs.FindByTableName(srcFK.PrimaryTable.Name);
                    if ((childTab == null) || (parentTab == null))
                    {
                        return; // both tables are not included
                    }
                    String relationName =
                        parentTab.Table.DataSet.RelationDefinition.CreateUniqueRelationName(srcFK.Name, childTab.TableName, parentTab.TableName);

                    RelationDefinitionRow curRelation = parentTab.InsertNewRelation(relationName, childTab.TableName);

                    IColumns parentColums = srcFK.PrimaryColumns;
                    IColumns childColums  = srcFK.ForeignColumns;

                    FieldRelationDefinitionRow curFieldRelation = null;

                    for (int colNo = 0; colNo < parentColums.Count; colNo++)
                    {
                        curFieldRelation = curRelation.InsertNewFieldRelation(parentColums[colNo].Name, childColums[colNo].Name);
                    }
                } // if (srcTab == srcFK.PrimaryTable)   // use only childrelations
            }     // foreach (IForeignKey srcFK in srcTab.ForeignKeys)
        }
Пример #2
0
        public static void ImportRelations(IDatabase srcDb, SchemaXsd3bEx destSet)
        {
            TableDefinitionDataTable destTabs = destSet.TableDefinition;

            foreach (ITable srcTab in srcDb.Tables)
            {
                ImportChildRelations(srcTab, destTabs);
            }
        }
Пример #3
0
        public static void ImportTable(ITable srcTab, TableDefinitionDataTable destTabs)
        {
            TableDefinitionRow destTab = destTabs.FindByTableName(srcTab.Name);

            if (destTab == null)
            {
                destTab           = destTabs.NewTableDefinitionRow();
                destTab.TableName = srcTab.Name;
                destTabs.AddTableDefinitionRow(destTab);
            }
            ImportTable(srcTab, destTab);
        }
Пример #4
0
 public static void ImportProc(IProcedure srcProc, TableDefinitionDataTable destTabs)
 {
     System.Diagnostics.Debug.WriteLine("Import Proc " + srcProc.Name);
     TableDefinitionRow destTab = destTabs.FindByTableName(srcProc.Name);
     if (destTab == null)
     {
         destTab = destTabs.NewTableDefinitionRow();
         destTab.TableName = srcProc.Name;
         destTabs.AddTableDefinitionRow(destTab);
     }
     ImportProc(srcProc, destTab);
 }
Пример #5
0
        public static void ImportProc(IProcedure srcProc, TableDefinitionDataTable destTabs)
        {
            System.Diagnostics.Debug.WriteLine("Import Proc " + srcProc.Name);
            TableDefinitionRow destTab = destTabs.FindByTableName(srcProc.Name);

            if (destTab == null)
            {
                destTab           = destTabs.NewTableDefinitionRow();
                destTab.TableName = srcProc.Name;
                destTabs.AddTableDefinitionRow(destTab);
            }
            ImportProc(srcProc, destTab);
        }
Пример #6
0
        public static void ImportView(IView srcView, TableDefinitionDataTable destTabs)
        {
            System.Diagnostics.Debug.WriteLine("Import View " + srcView.Name);
            TableDefinitionRow destTab = destTabs.FindByTableName(srcView.Name);

            if (destTab == null)
            {
                destTab           = destTabs.NewTableDefinitionRow();
                destTab.TableName = srcView.Name;
                destTabs.AddTableDefinitionRow(destTab);
            }
            ImportView(srcView, destTab);
        }
Пример #7
0
        public static void ImportChildRelations(ITable srcTab, TableDefinitionDataTable destTabs)
        {
            foreach (IForeignKey srcFK in srcTab.ForeignKeys)
            {
                if (srcTab == srcFK.PrimaryTable)   // use only childrelations
                {
                    TableDefinitionRow childTab = destTabs.FindByTableName(srcFK.ForeignTable.Name);
                    TableDefinitionRow parentTab = destTabs.FindByTableName(srcFK.PrimaryTable.Name);
                    if ((childTab == null) || (parentTab == null))
                        return; // both tables are not included

                    String relationName =
                    parentTab.Table.DataSet.RelationDefinition.CreateUniqueRelationName(srcFK.Name, childTab.TableName, parentTab.TableName);

                    RelationDefinitionRow curRelation = parentTab.InsertNewRelation(relationName, childTab.TableName);

                    IColumns parentColums = srcFK.PrimaryColumns;
                    IColumns childColums = srcFK.ForeignColumns;

                    FieldRelationDefinitionRow curFieldRelation = null;

                    for (int colNo = 0; colNo < parentColums.Count; colNo++)
                    {
                        curFieldRelation = curRelation.InsertNewFieldRelation(parentColums[colNo].Name, childColums[colNo].Name);
                    }
                } // if (srcTab == srcFK.PrimaryTable)   // use only childrelations
            } // foreach (IForeignKey srcFK in srcTab.ForeignKeys)

        }
Пример #8
0
 public static void ImportTable(ITable srcTab, TableDefinitionDataTable destTabs)
 {
     TableDefinitionRow destTab = destTabs.FindByTableName(srcTab.Name);
     if (destTab == null)
     {
         destTab = destTabs.NewTableDefinitionRow();
         destTab.TableName = srcTab.Name;
         destTabs.AddTableDefinitionRow(destTab);
     }
     ImportTable(srcTab, destTab);
 }
Пример #9
0
 public static void ImportView(IView srcView, TableDefinitionDataTable destTabs)
 {
     System.Diagnostics.Debug.WriteLine("Import View " + srcView.Name);
     TableDefinitionRow destTab = destTabs.FindByTableName(srcView.Name);
     if (destTab == null)
     {
         destTab = destTabs.NewTableDefinitionRow();
         destTab.TableName = srcView.Name;
         destTabs.AddTableDefinitionRow(destTab);
     }
     ImportView(srcView, destTab);
 }