Class PostgreSqlConstraintCollection
- Namespace
- LfrlAnvil.PostgreSql.Objects
- Assembly
- LfrlAnvil.PostgreSql.dll
Represents a collection of SQL table constraints.
public sealed class PostgreSqlConstraintCollection : SqlConstraintCollection, ISqlConstraintCollection, IReadOnlyCollection<ISqlConstraint>, IEnumerable<ISqlConstraint>, IEnumerable
- Inheritance
-
PostgreSqlConstraintCollection
- Implements
- Inherited Members
Remarks
PostgreSqlDialect implementation.
Properties
PrimaryKey
Table's primary key constraint.
public PostgreSqlPrimaryKey PrimaryKey { get; }
Property Value
Table
Table that this collection belongs to.
public PostgreSqlTable Table { get; }
Property Value
Methods
GetCheck(string)
Returns a check with the provided name
.
[Pure]
public PostgreSqlCheck GetCheck(string name)
Parameters
name
stringName of the check to return.
Returns
- PostgreSqlCheck
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]
public PostgreSqlForeignKey GetForeignKey(string name)
Parameters
name
stringName of the foreign key to return.
Returns
- PostgreSqlForeignKey
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]
public PostgreSqlIndex GetIndex(string name)
Parameters
name
stringName of the index to return.
Returns
- PostgreSqlIndex
Existing index.
Exceptions
- KeyNotFoundException
When index does not exist.
- SqlObjectCastException
When constraint exists but is not an index.
TryGetCheck(string)
Attempts to return a check with the provided name
.
[Pure]
public PostgreSqlCheck? TryGetCheck(string name)
Parameters
name
stringName of the check to return.
Returns
- PostgreSqlCheck
Existing check or null when check does not exist.
TryGetForeignKey(string)
Attempts to return a foreign key with the provided name
.
[Pure]
public PostgreSqlForeignKey? TryGetForeignKey(string name)
Parameters
name
stringName of the foreign key to return.
Returns
- PostgreSqlForeignKey
Existing foreign key or null when foreign key does not exist.
TryGetIndex(string)
Attempts to return an index with the provided name
.
[Pure]
public PostgreSqlIndex? TryGetIndex(string name)
Parameters
name
stringName of the index to return.
Returns
- PostgreSqlIndex
Existing index or null when index does not exist.