System.Data.DataSet.EnableConstraints C# (CSharp) Method

EnableConstraints() private method

private EnableConstraints ( ) : void
return void
        internal void EnableConstraints()
        {
            long logScopeId = DataCommonEventSource.Log.EnterScope("<ds.DataSet.EnableConstraints|INFO> {0}", ObjectID);
            try
            {
                bool errors = false;
                for (ConstraintEnumerator constraints = new ConstraintEnumerator(this); constraints.GetNext();)
                {
                    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)
                {
                    FailedEnableConstraints();
                }
            }
            finally
            {
                DataCommonEventSource.Log.ExitScope(logScopeId);
            }
        }