System.Data.ConstraintEnumerator.GetConstraint C# (CSharp) Method

GetConstraint() public method

public GetConstraint ( ) : Constraint
return Constraint
        public Constraint GetConstraint()
        {
            // If currentObject is null we are before first GetNext or after last GetNext--consumer is bad
            Debug.Assert(_currentObject != null, "GetObject should never be called w/ null currentObject.");
            return _currentObject;
        }

Usage Example

        internal void EnableConstraints()
        {
            IntPtr hscp;
            Bid.ScopeEnter(out hscp, "<ds.DataSet.EnableConstraints|INFO> %d#\n", ObjectID);
            try {
                bool errors = false;
                for (ConstraintEnumerator constraints = new ConstraintEnumerator(this); constraints.GetNext(); ) {
                    Constraint constraint = (Constraint)constraints.GetConstraint();
                    errors |= constraint.IsConstraintViolated();
                }

                foreach (DataTable table in Tables) {
                    foreach (DataColumn column in table.Columns) {
                        if (!column.AllowDBNull) {
                            errors |= column.IsNotAllowDBNullViolated();
                        }
                        if (column.MaxLength >= 0) {
                            errors |= column.IsMaxLengthViolated();
                        }
                    }
                }

                if (errors)
                    this.FailedEnableConstraints();
            }
            finally {
                Bid.ScopeLeave(ref hscp);
            }
        }
All Usage Examples Of System.Data.ConstraintEnumerator::GetConstraint