Esempio n. 1
0
        private void Create(string relationName, DataColumn[] parentColumns, DataColumn[] childColumns)
        {
            if (parentColumns.Length == 0 || childColumns.Length == 0)
            {
                throw ExceptionBuilder.KeyLengthZero();
            }

            if (parentColumns.Length != childColumns.Length)
            {
                throw ExceptionBuilder.KeyLengthMismatch();
            }

            for (int i = 0; i < parentColumns.Length; i++)
            {
                if (parentColumns[i].Computed)
                {
                    throw ExceptionBuilder.ExpressionInConstraint(parentColumns[i]);
                }
                if (childColumns[i].Computed)
                {
                    throw ExceptionBuilder.ExpressionInConstraint(childColumns[i]);
                }
            }

            this.parentKey = new DataKey(parentColumns);
            this.childKey  = new DataKey(childColumns);

            ConstraintName = relationName;

            CheckState();
        }
Esempio n. 2
0
 private void Create(string constraintName, DataColumn[] columns)
 {
     for (int i = 0; i < columns.Length; i++)
     {
         if (columns[i].Computed)
         {
             throw ExceptionBuilder.ExpressionInConstraint(columns[i]);
         }
     }
     _key           = new DataKey(columns, true);
     ConstraintName = constraintName;
     NonVirtualCheckState();
 }