C# Class System.Data.DataRelationCollection

Inheritance: InternalDataCollectionBase
Datei anzeigen Open project: dotnet/corefx Class Usage Examples

Private Properties

Property Type Description
AssignName string
InternalIndexOf int
MakeName string
RegisterName void
UnregisterName void

Public Methods

Method Description
Add ( DataColumn parentColumns, DataColumn childColumns ) : DataRelation

Creates a relation given the parameters and adds it to the collection. The name is defaulted. An ArgumentException is thrown if this relation already belongs to this collection or belongs to another collection. An InvalidConstraintException is thrown if the relation can't be created based on the parameters. The CollectionChanged event is fired if it succeeds.

Add ( string name, DataColumn parentColumns, DataColumn childColumns ) : DataRelation

Creates a with the specified name, parent columns, child columns, and adds it to the collection.

Add ( string name, DataColumn parentColumns, DataColumn childColumns, bool createConstraints ) : DataRelation

Creates a relation given the parameters and adds it to the collection. An ArgumentNullException is thrown if this relation is null. An ArgumentException is thrown if this relation already belongs to this collection, belongs to another collection, or if this collection already has a relation with the same name (case insensitive). An InvalidRelationException is thrown if the relation can't be created based on the parameters. The CollectionChanged event is fired if it succeeds.

Add ( DataRelation relation ) : void

Adds the relation to the collection.

AddRange ( DataRelation relations ) : void
CanRemove ( DataRelation relation ) : bool

Verifies if a given relation can be removed from the collection.

Clear ( ) : void

Clears the collection of any relations.

Contains ( string name ) : bool

Returns true if this collection has a relation with the given name (case insensitive), false otherwise.

CopyTo ( DataRelation array, int index ) : void
IndexOf ( DataRelation relation ) : int

Returns the index of a specified .

IndexOf ( string relationName ) : int

Returns the index of the relation with the given name (case insensitive), or -1 if the relation doesn't exist in the collection.

Remove ( DataRelation relation ) : void

Removes the given relation from the collection. An ArgumentNullException is thrown if this relation is null. An ArgumentException is thrown if this relation doesn't belong to this collection. The CollectionChanged event is fired if it succeeds.

Remove ( string name ) : void

Removes the relation with the given name from the collection. An IndexOutOfRangeException is thrown if this collection doesn't have a relation with that name The CollectionChanged event is fired if it succeeds.

RemoveAt ( int index ) : void

Removes the relation at the given index from the collection. An IndexOutOfRangeException is thrown if this collection doesn't have a relation at this index. The CollectionChanged event is fired if it succeeds.

this ( int index ) : DataRelation

Gets the relation specified by index.

this ( string name ) : DataRelation

Gets the relation specified by name.

Protected Methods

Method Description
AddCore ( DataRelation relation ) : void

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

GetDataSet ( ) : DataSet

Gets the dataSet for this collection.

OnCollectionChanged ( CollectionChangeEventArgs ccevent ) : void

This method is called whenever the collection changes. Overriders of this method should call the base implementation of this method.

OnCollectionChanging ( CollectionChangeEventArgs ccevent ) : void
RemoveCore ( DataRelation relation ) : void

Does verification on the relation. An ArgumentNullException is thrown if this relation is null. An ArgumentException is thrown if this relation doesn't belong to this collection.

Private Methods

Method Description
AssignName ( ) : string

Creates a new default name.

InternalIndexOf ( string name ) : int
MakeName ( int index ) : string

Makes a default name with the given index. e.g. Relation1, Relation2, ... Relationi

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 Relation.RelationName 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 Relation.RelationName 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

Creates a relation given the parameters and adds it to the collection. The name is defaulted. An ArgumentException is thrown if this relation already belongs to this collection or belongs to another collection. An InvalidConstraintException is thrown if the relation can't be created based on the parameters. The CollectionChanged event is fired if it succeeds.
public Add ( DataColumn parentColumns, DataColumn childColumns ) : DataRelation
parentColumns DataColumn
childColumns DataColumn
return DataRelation

Add() public method

Creates a with the specified name, parent columns, child columns, and adds it to the collection.
public Add ( string name, DataColumn parentColumns, DataColumn childColumns ) : DataRelation
name string
parentColumns DataColumn
childColumns DataColumn
return DataRelation

Add() public method

Creates a relation given the parameters and adds it to the collection. An ArgumentNullException is thrown if this relation is null. An ArgumentException is thrown if this relation already belongs to this collection, belongs to another collection, or if this collection already has a relation with the same name (case insensitive). An InvalidRelationException is thrown if the relation can't be created based on the parameters. The CollectionChanged event is fired if it succeeds.
public Add ( string name, DataColumn parentColumns, DataColumn childColumns, bool createConstraints ) : DataRelation
name string
parentColumns DataColumn
childColumns DataColumn
createConstraints bool
return DataRelation

Add() public method

Adds the relation to the collection.
public Add ( DataRelation relation ) : void
relation DataRelation
return void

AddCore() protected method

Does verification on the table. An ArgumentNullException is thrown if this relation is null. An ArgumentException is thrown if this relation already belongs to this collection, belongs to another collection. A DuplicateNameException is thrown if this collection already has a relation with the same name (case insensitive).
protected AddCore ( DataRelation relation ) : void
relation DataRelation
return void

AddRange() public method

public AddRange ( DataRelation relations ) : void
relations DataRelation
return void

CanRemove() public method

Verifies if a given relation can be removed from the collection.
public CanRemove ( DataRelation relation ) : bool
relation DataRelation
return bool

Clear() public method

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

Contains() public method

Returns true if this collection has a relation with the given name (case insensitive), false otherwise.
public Contains ( string name ) : bool
name string
return bool

CopyTo() public method

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

GetDataSet() protected abstract method

Gets the dataSet for this collection.
protected abstract GetDataSet ( ) : DataSet
return DataSet

IndexOf() public method

Returns the index of a specified .
public IndexOf ( DataRelation relation ) : int
relation DataRelation
return int

IndexOf() public method

Returns the index of the relation with the given name (case insensitive), or -1 if the relation doesn't exist in the collection.
public IndexOf ( string relationName ) : int
relationName string
return int

OnCollectionChanged() protected method

This method is called whenever the collection changes. Overriders of this method should call the base implementation of this method.
protected OnCollectionChanged ( CollectionChangeEventArgs ccevent ) : void
ccevent System.ComponentModel.CollectionChangeEventArgs
return void

OnCollectionChanging() protected method

protected OnCollectionChanging ( CollectionChangeEventArgs ccevent ) : void
ccevent System.ComponentModel.CollectionChangeEventArgs
return void

Remove() public method

Removes the given relation from the collection. An ArgumentNullException is thrown if this relation is null. An ArgumentException is thrown if this relation doesn't belong to this collection. The CollectionChanged event is fired if it succeeds.
public Remove ( DataRelation relation ) : void
relation DataRelation
return void

Remove() public method

Removes the relation with the given name from the collection. An IndexOutOfRangeException is thrown if this collection doesn't have a relation with that name The CollectionChanged event is fired if it succeeds.
public Remove ( string name ) : void
name string
return void

RemoveAt() public method

Removes the relation at the given index from the collection. An IndexOutOfRangeException is thrown if this collection doesn't have a relation at this index. The CollectionChanged event is fired if it succeeds.
public RemoveAt ( int index ) : void
index int
return void

RemoveCore() protected method

Does verification on the relation. An ArgumentNullException is thrown if this relation is null. An ArgumentException is thrown if this relation doesn't belong to this collection.
protected RemoveCore ( DataRelation relation ) : void
relation DataRelation
return void

this() public abstract method

Gets the relation specified by index.
public abstract this ( int index ) : DataRelation
index int
return DataRelation

this() public abstract method

Gets the relation specified by name.
public abstract this ( string name ) : DataRelation
name string
return DataRelation