System.Data.ForeignKeyConstraint.IsConstraintViolated C# (CSharp) Method

IsConstraintViolated() private method

private IsConstraintViolated ( ) : bool
return bool
        internal override bool IsConstraintViolated()
        {
            Index childIndex = _childKey.GetSortIndex();
            object[] uniqueChildKeys = childIndex.GetUniqueKeyValues();
            bool errors = false;

            Index parentIndex = _parentKey.GetSortIndex();
            for (int i = 0; i < uniqueChildKeys.Length; i++)
            {
                object[] childValues = (object[])uniqueChildKeys[i];

                if (!IsKeyNull(childValues))
                {
                    if (!parentIndex.IsKeyInIndex(childValues))
                    {
                        DataRow[] rows = childIndex.GetRows(childIndex.FindRecords(childValues));
                        string error = SR.Format(SR.DataConstraint_ForeignKeyViolation, ConstraintName, ExceptionBuilder.KeysToString(childValues));
                        for (int j = 0; j < rows.Length; j++)
                        {
                            rows[j].RowError = error;
                        }
                        errors = true;
                    }
                }
            }
            return errors;
        }