C# Class System.Data.ConstraintCollection

Inheritance: InternalDataCollectionBase
显示文件 Open project: dotnet/corefx Class Usage Examples

Private Properties

Property Type Description
Add void
AddForeignKeyConstraint void
AddUniqueConstraint void
ArrayAdd void
ArrayRemove void
AssignName string
AutoGenerated bool
BaseAdd void
BaseGroupSwitch void
BaseRemove void
CanRemove bool
CompareArrays bool
ConstraintCollection System.Diagnostics
Contains bool
FindConstraint Constraint
FindForeignKeyConstraint ForeignKeyConstraint
FindKeyConstraint UniqueConstraint
FinishInitConstraints void
InternalIndexOf int
MakeName string
OnCollectionChanged void
RegisterName void
UnregisterName void

Public Methods

Method Description
Add ( string name, DataColumn primaryKeyColumn, DataColumn foreignKeyColumn ) : Constraint

Constructs a new with the specified parent and child columns and adds the constraint to the collection.

Add ( string name, DataColumn columns, bool primaryKey ) : Constraint

Constructs a new using the specified array of objects and adds it to the collection.

Add ( Constraint constraint ) : void

Adds the constraint to the collection.

AddRange ( Constraint constraints ) : void
CanRemove ( Constraint constraint ) : bool

Indicates if a can be removed.

Clear ( ) : void

Clears the collection of any objects.

Contains ( string name ) : bool

Indicates whether the , specified by name, exists in the collection.

CopyTo ( Constraint array, int index ) : void
IndexOf ( Constraint constraint ) : int

Returns the index of the specified .

IndexOf ( string constraintName ) : int

Returns the index of the , specified by name.

Remove ( Constraint constraint ) : void

Removes the specified from the collection.

Remove ( string name ) : void

Removes the constraint, specified by name, from the collection.

RemoveAt ( int index ) : void

Removes the constraint at the specified index from the collection.

this ( int index ) : Constraint

Gets the from the collection at the specified index.

this ( string name ) : Constraint

Gets the from the collection with the specified name.

Private Methods

Method Description
Add ( Constraint constraint, bool addUniqueWhenAddingForeign ) : void
AddForeignKeyConstraint ( ForeignKeyConstraint constraint ) : void
AddUniqueConstraint ( UniqueConstraint constraint ) : void
ArrayAdd ( Constraint constraint ) : void

Adds the constraint to the constraints array.

ArrayRemove ( Constraint constraint ) : void
AssignName ( ) : string

Creates a new default name.

AutoGenerated ( Constraint constraint ) : bool
BaseAdd ( Constraint constraint ) : void

Does verification on the constraint and it's name. An ArgumentNullException is thrown if this constraint is null. An ArgumentException is thrown if this constraint already belongs to this collection, belongs to another collection. A DuplicateNameException is thrown if this collection already has a constraint with the same name (case insensitive).

BaseGroupSwitch ( Constraint oldArray, int oldLength, Constraint newArray, int newLength ) : void

BaseGroupSwitch will intelligently remove and add tables from the collection.

BaseRemove ( Constraint constraint ) : void

Does verification on the constraint and it's name. An ArgumentNullException is thrown if this constraint is null. An ArgumentException is thrown if this constraint doesn't belong to this collection or if this constraint is part of a relationship.

CanRemove ( Constraint constraint, bool fThrowException ) : bool
CompareArrays ( DataColumn a1, DataColumn a2 ) : bool
ConstraintCollection ( DataTable table ) : System.Diagnostics

ConstraintCollection constructor. Used only by DataTable.

Contains ( string name, bool caseSensitive ) : bool
FindConstraint ( Constraint constraint ) : Constraint

Returns a matching constriant object.

FindForeignKeyConstraint ( DataColumn parentColumns, DataColumn childColumns ) : ForeignKeyConstraint

Returns a matching constriant object.

FindKeyConstraint ( DataColumn columns ) : UniqueConstraint

Returns a matching constriant object.

FinishInitConstraints ( ) : void
InternalIndexOf ( string constraintName ) : int
MakeName ( int index ) : string

Makes a default name with the given index. e.g. Constraint1, Constraint2, ... Constrainti

OnCollectionChanged ( CollectionChangeEventArgs ccevent ) : void

Raises the event.

RegisterName ( string name ) : void

Registers this name as being used in the collection. Will throw an ArgumentException if the name is already being used. Called by Add, All property, and Constraint.ConstraintName property. if the name is equivalent to the next default name to hand out, we increment our defaultNameIndex.

UnregisterName ( string name ) : void

Unregisters this name as no longer being used in the collection. Called by Remove, All property, and Constraint.ConstraintName property. If the name is equivalent to the last proposed default name, we walk backwards to find the next proper default name to use.

Method Details

Add() public method

Constructs a new with the specified parent and child columns and adds the constraint to the collection.
public Add ( string name, DataColumn primaryKeyColumn, DataColumn foreignKeyColumn ) : Constraint
name string
primaryKeyColumn DataColumn
foreignKeyColumn DataColumn
return Constraint

Add() public method

Constructs a new using the specified array of objects and adds it to the collection.
public Add ( string name, DataColumn columns, bool primaryKey ) : Constraint
name string
columns DataColumn
primaryKey bool
return Constraint

Add() public method

Adds the constraint to the collection.
public Add ( Constraint constraint ) : void
constraint Constraint
return void

AddRange() public method

public AddRange ( Constraint constraints ) : void
constraints Constraint
return void

CanRemove() public method

Indicates if a can be removed.
public CanRemove ( Constraint constraint ) : bool
constraint Constraint
return bool

Clear() public method

Clears the collection of any objects.
public Clear ( ) : void
return void

Contains() public method

Indicates whether the , specified by name, exists in the collection.
public Contains ( string name ) : bool
name string
return bool

CopyTo() public method

public CopyTo ( Constraint array, int index ) : void
array Constraint
index int
return void

IndexOf() public method

Returns the index of the specified .
public IndexOf ( Constraint constraint ) : int
constraint Constraint
return int

IndexOf() public method

Returns the index of the , specified by name.
public IndexOf ( string constraintName ) : int
constraintName string
return int

Remove() public method

Removes the specified from the collection.
public Remove ( Constraint constraint ) : void
constraint Constraint
return void

Remove() public method

Removes the constraint, specified by name, from the collection.
public Remove ( string name ) : void
name string
return void

RemoveAt() public method

Removes the constraint at the specified index from the collection.
public RemoveAt ( int index ) : void
index int
return void

this() public method

Gets the from the collection at the specified index.
public this ( int index ) : Constraint
index int
return Constraint

this() public method

Gets the from the collection with the specified name.
public this ( string name ) : Constraint
name string
return Constraint