Interface ISqlConstraintCollection
Represents a collection of SQL table constraints.
public interface ISqlConstraintCollection : IReadOnlyCollection<ISqlConstraint>, IEnumerable<ISqlConstraint>, IEnumerable
- Inherited Members
Properties
PrimaryKey
Table's primary key constraint.
ISqlPrimaryKey PrimaryKey { get; }
Property Value
Table
Table that this collection belongs to.
ISqlTable Table { get; }
Property Value
Methods
Contains(string)
Checks whether or not a constraint with the provided name
exists.
[Pure]
bool Contains(string name)
Parameters
name
stringName to check.
Returns
- bool
true when constraint exists, otherwise false.
Get(string)
Returns a constraint with the provided name
.
[Pure]
ISqlConstraint Get(string name)
Parameters
name
stringName of the constraint to return.
Returns
- ISqlConstraint
Existing constraint.
Exceptions
- KeyNotFoundException
When constraint does not exist.
GetCheck(string)
Returns a check with the provided name
.
[Pure]
ISqlCheck GetCheck(string name)
Parameters
name
stringName of the check to return.
Returns
- ISqlCheck
Existing check.
Exceptions
- KeyNotFoundException
When check does not exist.
- SqlObjectCastException
When constraint exists but is not a check.
GetForeignKey(string)
Returns a foreign key with the provided name
.
[Pure]
ISqlForeignKey GetForeignKey(string name)
Parameters
name
stringName of the foreign key to return.
Returns
- ISqlForeignKey
Existing foreign key.
Exceptions
- KeyNotFoundException
When foreign key does not exist.
- SqlObjectCastException
When constraint exists but is not a foreign key.
GetIndex(string)
Returns an index with the provided name
.
[Pure]
ISqlIndex GetIndex(string name)
Parameters
name
stringName of the index to return.
Returns
- ISqlIndex
Existing index.
Exceptions
- KeyNotFoundException
When index does not exist.
- SqlObjectCastException
When constraint exists but is not an index.
TryGet(string)
Attempts to return a constraint with the provided name
.
[Pure]
ISqlConstraint? TryGet(string name)
Parameters
name
stringName of the constraint to return.
Returns
- ISqlConstraint
Existing constraint or null when constraint does not exist.
TryGetCheck(string)
Attempts to return a check with the provided name
.
[Pure]
ISqlCheck? TryGetCheck(string name)
Parameters
name
stringName of the check to return.
Returns
- ISqlCheck
Existing check or null when check does not exist.
TryGetForeignKey(string)
Attempts to return a foreign key with the provided name
.
[Pure]
ISqlForeignKey? TryGetForeignKey(string name)
Parameters
name
stringName of the foreign key to return.
Returns
- ISqlForeignKey
Existing foreign key or null when foreign key does not exist.
TryGetIndex(string)
Attempts to return an index with the provided name
.
[Pure]
ISqlIndex? TryGetIndex(string name)
Parameters
name
stringName of the index to return.
Returns
- ISqlIndex
Existing index or null when index does not exist.