/// <summary> /// Clones this instance. /// </summary> /// <returns></returns> public Column Clone() { var rc = new Column { Default = Default }; if (Identity != null) { rc.Identity = Identity.Clone(); } rc.Nullable = Nullable; rc.Length = Length; rc.Name = Name; rc.Position = Position; rc.Precision = Precision; rc.Scale = Scale; rc.Type = Type; return(rc); }
/// <summary> /// Clones this instance. /// </summary> /// <param name="newDefaultName">If true, if a default constraint is set it will be given a new, random name for the cloned instance.</param> /// <returns></returns> public Column Clone(bool newDefaultName) { var newName = Guid.NewGuid().ToString("n"); Column rc = this.Default != null ? new Column { Default = Default.Clone(newDefaultName ? $"default_{newName}" : null) } : new Column(); if (Identity != null) { rc.Identity = Identity.Clone(); } rc.Nullable = Nullable; rc.Length = Length; rc.Name = Name; rc.Position = Position; rc.Precision = Precision; rc.Scale = Scale; rc.Type = Type; return(rc); }