Ejemplo 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();
        }
Ejemplo 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;
            }
        }
Ejemplo 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();
            }
        }
Ejemplo 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();
 }
Ejemplo 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);
Ejemplo n.º 9
0
 public void createAsNewItem(DB.Database existingDatabase)
 {
     //do nothing. deleting or adding of base datatypes should happen manually in the EA GUI
 }
Ejemplo n.º 10
0
 public override void createAsNewItem(DB.Database existingDatabase)
 {
     //TODO: figure out how to handle creation of new databases
 }