Пример #1
0
        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);
            }
        }
 internal void EnableConstraints()
 {
     IntPtr ptr;
     Bid.ScopeEnter(out ptr, "<ds.DataSet.EnableConstraints|INFO> %d#\n", this.ObjectID);
     try
     {
         bool flag = false;
         ConstraintEnumerator enumerator3 = new ConstraintEnumerator(this);
         while (enumerator3.GetNext())
         {
             Constraint constraint = enumerator3.GetConstraint();
             flag |= constraint.IsConstraintViolated();
         }
         foreach (DataTable table in this.Tables)
         {
             foreach (DataColumn column in table.Columns)
             {
                 if (!column.AllowDBNull)
                 {
                     flag |= column.IsNotAllowDBNullViolated();
                 }
                 if (column.MaxLength >= 0)
                 {
                     flag |= column.IsMaxLengthViolated();
                 }
             }
         }
         if (flag)
         {
             this.FailedEnableConstraints();
         }
     }
     finally
     {
         Bid.ScopeLeave(ref ptr);
     }
 }
Пример #3
0
        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);
            }
        }