private static void Init(UniqueConstraintColumn uniqueConstraintColumn, UniqueConstraint uniqueConstraint, string objectName)
 {
     uniqueConstraintColumn.UniqueConstraint = uniqueConstraint;
     uniqueConstraintColumn.ObjectName = objectName;
     uniqueConstraintColumn.IsDescendingKey = false;
     uniqueConstraintColumn.KeyOrdinal = 1;
     uniqueConstraintColumn.PartitionOrdinal = 0;
 }
		/// <summary>
        /// Deep Clone and Shallow Clone... Leaf Node.
        /// A clone of this class's instance specific metadata.
        /// </summary>
        /// <param name="uniqueConstraintColumn">The unique constraint column to clone.</param>
        /// <returns>A clone of this class's instance specific metadata.</returns>
        public static UniqueConstraintColumn Clone(UniqueConstraintColumn uniqueConstraintColumn)
        {
            return new UniqueConstraintColumn
            {
                ObjectName = uniqueConstraintColumn.ObjectName,
                KeyOrdinal = uniqueConstraintColumn.KeyOrdinal,
                PartitionOrdinal = uniqueConstraintColumn.PartitionOrdinal
            };
        }
示例#3
0
        /// <summary>
        /// Deep Clone...
        /// A clone of this class and clones of all assosiated metadata.
        /// </summary>
        /// <param name="uniqueConstraint">The unique constraint to deep clone.</param>
        /// <returns>A clone of this class and clones of all assosiated metadata.</returns>
        public static UniqueConstraint Clone(UniqueConstraint uniqueConstraint)
        {
            var uniqueConstraintClone = new UniqueConstraint
            {
                ObjectName     = uniqueConstraint.ObjectName,
                AllowPageLocks = uniqueConstraint.AllowPageLocks,
                AllowRowLocks  = uniqueConstraint.AllowRowLocks,
                FileGroup      = uniqueConstraint.FileGroup,
                FillFactor     = uniqueConstraint.FillFactor,
                IgnoreDupKey   = uniqueConstraint.IgnoreDupKey,
                IndexType      = uniqueConstraint.IndexType,
                IsClustered    = uniqueConstraint.IsClustered,
                IsDisabled     = uniqueConstraint.IsDisabled,
                IsPadded       = uniqueConstraint.IsPadded
            };

            foreach (var uniqueConstraintColumn in uniqueConstraint.UniqueConstraintColumns)
            {
                AddUniqueConstraintColumn(uniqueConstraintClone, UniqueConstraintColumn.Clone(uniqueConstraintColumn));
            }

            return(uniqueConstraintClone);
        }
示例#4
0
        public static void AddUniqueConstraintColumn(UniqueConstraint uniqueConstraint, UniqueConstraintColumn uniqueConstraintColumn)
        {
            if (uniqueConstraintColumn.UniqueConstraint != null && !uniqueConstraintColumn.UniqueConstraint.Equals(uniqueConstraint))
            {
                RemoveUniqueConstraintColumn(uniqueConstraintColumn.UniqueConstraint, uniqueConstraintColumn);
            }

            uniqueConstraint.UniqueConstraintColumns.Add(uniqueConstraintColumn);
        }
示例#5
0
 public static void RemoveUniqueConstraintColumn(UniqueConstraint uniqueConstraint, UniqueConstraintColumn uniqueConstraintColumn)
 {
     uniqueConstraint.UniqueConstraintColumns.Remove(uniqueConstraintColumn.Namespace);
 }