예제 #1
0
        public static void CreateObject(this IDatabaseSource conn, IAbstractObjectStructure obj)
        {
            DatabaseStructure oldDb = new DatabaseStructure();
            DatabaseStructure newDb = new DatabaseStructure(oldDb);

            newDb.AddObject(obj, true);
            conn.AlterDatabase(oldDb, newDb);
        }
예제 #2
0
        public static void DropObject(this IDatabaseSource conn, IAbstractObjectStructure obj)
        {
            DatabaseStructure oldDb = new DatabaseStructure();

            oldDb.AddObject(obj, true);
            DatabaseStructure newDb = new DatabaseStructure(oldDb);

            newDb.DropObject(obj);
            conn.AlterDatabase(oldDb, newDb, DbDiffOptions.AlterStructureOptions());
        }
예제 #3
0
        public static void ChangeObject(this IDatabaseSource conn, IAbstractObjectStructure oldObj, Action <AbstractObjectStructure> changeFunc)
        {
            DatabaseStructure oldDb = new DatabaseStructure();

            oldDb.AddObject(oldObj, true);
            DatabaseStructure       newDb  = new DatabaseStructure(oldDb);
            AbstractObjectStructure newObj = (AbstractObjectStructure)newDb.FindByGroupId(oldObj);

            changeFunc(newObj);
            conn.AlterDatabase(oldDb, newDb, DbDiffOptions.AlterStructureOptions());
        }
예제 #4
0
        public static DbObjectPairing CreateTablePairing(ITableStructure oldTable, ITableStructure newTable)
        {
            DatabaseStructure src = new DatabaseStructure();
            DatabaseStructure dst = new DatabaseStructure(src);

            src.AddObject(oldTable, true);
            dst.AddObject(newTable, true);
            DbObjectPairing pairing = new DbObjectPairing(src, dst);

            return(pairing);
        }
예제 #5
0
        public static void AlterObject(this IDatabaseSource conn, IAbstractObjectStructure oldObj, IAbstractObjectStructure newObj, DbDiffOptions options)
        {
            if (oldObj == null)
            {
                conn.CreateObject(newObj);
                return;
            }
            if (newObj == null)
            {
                conn.DropObject(oldObj);
                return;
            }
            if (oldObj.GroupId != newObj.GroupId)
            {
                throw new InternalError("DAE-00010 Altering object with different groupid");
            }
            DatabaseStructure oldDb = new DatabaseStructure();
            DatabaseStructure newDb = new DatabaseStructure(oldDb);

            oldDb.AddObject(oldObj, true);
            newDb.AddObject(newObj, true);
            conn.AlterDatabase(oldDb, newDb, options);
        }