Esempio n. 1
0
        public override void createAsNewItem(DB.Database existingDatabase)
        {
            var newTable = new Table((Database)existingDatabase, this.name);

            newTable._logicalClasses = new List <Class>(_logicalClasses);
            newTable.save();
        }
Esempio n. 2
0
        public void save(DB.Database existingDatabase)
        {
            switch (this.comparisonStatus)
            {
            case DatabaseComparisonStatusEnum.equal:
                //make sure the translation sticks
                if (this.newDatabaseItem.logicalElement != null)
                {
                    this.newDatabaseItem.logicalElement.save();
                }
                break;

            case DatabaseComparisonStatusEnum.changed:
                this.existingDatabaseItem.update(this.newDatabaseItem);
                break;

            case DatabaseComparisonStatusEnum.dboverride:
                if (this.newDatabaseItem != null && this.newDatabaseItem.isOverridden)
                {
                    this.existingDatabaseItem.update(this.newDatabaseItem);
                }
                break;

            case DatabaseComparisonStatusEnum.deletedItem:
                this.existingDatabaseItem.delete();
                break;

            case DatabaseComparisonStatusEnum.newItem:
                this.newDatabaseItem.createAsNewItem(existingDatabase);
                break;
            }
        }
Esempio n. 3
0
        public override void createAsNewItem(DB.Database existingDatabase)
        {
            //look for corresponding table in existingDatabase
            Table newTable = (Table)existingDatabase.tables.FirstOrDefault(x => x.name == this.owner.name);

            if (newTable != null)
            {
                var newPrimaryKey = new PrimaryKey(newTable, this._involvedColumns);
                newPrimaryKey.name         = name;
                newPrimaryKey.isOverridden = this.isOverridden;
                newPrimaryKey.save();
            }
        }
        public override void createAsNewItem(DB.Database existingDatabase)
        {
            //look for corresponding table in existingDatabase
            Table newTable = (Table)existingDatabase.tables.FirstOrDefault(x => x.name == this.ownerTable.name);

            if (newTable != null)
            {
                var newColumn = new Column(newTable, this.name);
                newColumn.isNotNullable    = _isNotNullable;
                newColumn.type             = _type;
                newColumn.logicalAttribute = _logicalAttribute;
                newColumn.isOverridden     = isOverridden;
                newColumn.save();
            }
        }
Esempio n. 5
0
        public override void createAsNewItem(DB.Database existingDatabase)
        {
            //look for corresponding table in existingDatabase
            Table newTable        = (Table)existingDatabase.tables.FirstOrDefault(x => x.name == this.ownerTable.name);
            var   newForeignTable = existingDatabase.tables.FirstOrDefault(x => x.name == this._foreignTable.name);

            if (newTable != null && newForeignTable != null)
            {
                var newForeignKey = new ForeignKey(newTable, this._involvedColumns);
                newForeignKey.name                = name;
                newForeignKey._foreignTable       = (Table)newForeignTable;
                newForeignKey._logicalAssociation = _logicalAssociation;
                newForeignKey.isOverridden        = isOverridden;
                newForeignKey.save();
            }
        }
 public void createAsNewItem(DB.Database existingDatabase)
 {
     throw new NotImplementedException();
 }
Esempio n. 7
0
        public void save(DB.Database existingDatabase)
        {
            //take care of the renames
            if (this.isRenamed && this.existingDatabaseItem != null)
            {
                this.existingDatabaseItem.name = this.renamedName;
            }
            switch (this.comparisonStatus)
            {
            case DatabaseComparisonStatusEnum.equal:
                //make sure the translation sticks
                foreach (var logical in newDatabaseItem.logicalElements)
                {
                    if (logical != null)
                    {
                        logical.save();
                    }
                }
                //make sure the position is saved
                this.existingDatabaseItem.save();
                break;

            case DatabaseComparisonStatusEnum.changed:
                this.existingDatabaseItem.update(this.newDatabaseItem);
                break;

            case DatabaseComparisonStatusEnum.dboverride:
                if (this.newDatabaseItem != null && this.newDatabaseItem.isOverridden)
                {
                    if (this.existingDatabaseItem != null)
                    {
                        this.existingDatabaseItem.update(this.newDatabaseItem);
                    }
                    else
                    {
                        //save the override tag?
                        //TODO: check if this is needed
                    }
                }
                break;

            case DatabaseComparisonStatusEnum.deletedItem:
                this.existingDatabaseItem.delete();
                break;

            case DatabaseComparisonStatusEnum.newItem:
                if (ownerComparison != null &&
                    ownerComparison.existingDatabaseItem != null)
                {
                    if (isRenamed)
                    {
                        this.newDatabaseItem.createAsNewItem(ownerComparison.existingDatabaseItem, this.renamedName);
                    }
                    else
                    {
                        this.newDatabaseItem.createAsNewItem(ownerComparison.existingDatabaseItem);
                    }
                }
                else
                {
                    if (this.isRenamed)
                    {
                        this.newDatabaseItem.createAsNewItem(existingDatabase, this.renamedName);
                    }
                    else
                    {
                        this.newDatabaseItem.createAsNewItem(existingDatabase);
                    }
                }
                break;
            }
        }
 public abstract void createAsNewItem(DB.Database existingDatabase);
Esempio n. 9
0
 public void createAsNewItem(DB.Database existingDatabase)
 {
     //do nothing. deleting or adding of base datatypes should happen manually in the EA GUI
 }
Esempio n. 10
0
 public override void createAsNewItem(DB.Database existingDatabase)
 {
     //TODO: figure out how to handle creation of new databases
 }