|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
useless UniqueConstraint constructors...Why there are UniqueConstraint constructors that accept a bool that sets the constraint as primary key if the flag is not used?? this is the code inside IsPrimaryKey property... public bool IsPrimaryKey { get { if (this.Table == null) { return false; } return (this == this.Table.primaryKey); } } many thanks, Dan The UniqueConstraint ctor tracks that boolean so during
table.Constraints.Add, if true and the table doesn't have a primary key - the constraint will become the primary key. The IsPrimaryKey property simply returns if this UniqueConstraint instance is the one used by the DataTable for its primary key. Show quote "Dan" wrote: > Hi, > > Why there are UniqueConstraint constructors that accept a bool that sets the > constraint as primary key if the flag is not used?? > > this is the code inside IsPrimaryKey property... > > public bool IsPrimaryKey > { > get > { > if (this.Table == null) > { > return false; > } > return (this == this.Table.primaryKey); > } > } > > many thanks, > Dan |
|||||||||||||||||||||||