EAAddinFramework.Databases.Column.save C# (CSharp) Method

save() public method

public save ( ) : void
return void
        public override void save()
        {
            //create the _wrapped attribute if needed
            if (_wrappedattribute == null)
            {
                if (this._ownerTable._wrappedClass == null)
                {
                    this.ownerTable.save();
                }
                //now the wrappedClass should exist. if not then we have a problem
                this._wrappedattribute = this.factory.modelFactory.createNewElement<TSF_EA.Attribute>(this._ownerTable._wrappedClass,this.name);
            }
            if (_wrappedattribute != null)
            {
                //set steretotype
                this._wrappedattribute.setStereotype("column");
                //set datatype;
                _wrappedattribute.type = this.factory.modelFactory.createPrimitiveType(this.type.name);
                if (this.type.type.hasPrecision)
                {
                    _wrappedattribute.precision = this.type.length;
                    _wrappedattribute.scale = this.type.precision;
                }
                else
                {
                    _wrappedattribute.length = this.type.length;
                }
                //is not nullable
                this.isNotNullable = _isNotNullable;
                //set position
                _wrappedattribute.position = _position;
                //save
                _wrappedattribute.save();
                //set isOverridden
                this.isOverridden = this.isOverridden;
                //set renamed
                this.isRenamed = this.isRenamed;
                //logical attribute tag value
                if (traceTaggedValue == null) createTraceTaggedValue();

            }
            //save the columnn name in the alias
            if (logicalAttribute != null) logicalAttribute.save();
        }

Usage Example

        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();
            }
        }
All Usage Examples Of EAAddinFramework.Databases.Column::save