Name

ConstraintCollection

Synopsis

This collection stores the constraints for a table, which it exposes through the DataTable.Constraints property. It can contain any class that derives from Constraint, including ForeignKeyConstraint and UniqueConstraint objects. You can retrieve an individual constraint by index or name.

public class ConstraintCollection : InternalDataCollectionBase {

// Public Instance Properties

   public virtual Constraint this[string 

                  name

                  ]{get; } 

   public virtual Constraint this[int 

                  index

                  ]{get; } 

// Protected Instance Properties

   protected override ArrayList List{get; }                    // overrides InternalDataCollectionBase

                  // Public Instance Methods

   public virtual Constraint Add(string name, DataColumn[ ] columns, bool primaryKey);

   public virtual Constraint Add(string name, DataColumn[ ] primaryKeyColumns, DataColumn[ ] foreignKeyColumns);

   public virtual Constraint Add(string name, DataColumn column, bool primaryKey);

   public virtual Constraint Add(string name, DataColumn primaryKeyColumn, DataColumn foreignKeyColumn);

   public void Add(Constraint constraint);  

   public void AddRange(Constraint[ ] constraints);  

   public bool CanRemove(Constraint constraint);  

   public void Clear( );  

   public bool Contains(string name);  

   public int IndexOf(Constraint constraint);  

   public virtual int IndexOf(string constraintName);  

   public void Remove(Constraint constraint);  

   public void Remove(string name);  

   public void RemoveAt(int index);  

// Protected Instance Methods

   protected virtual void OnCollectionChanged ...

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.