Interface ISqlConstraintBuilderCollection
Represents a collection of SQL table constraint builders.
public interface ISqlConstraintBuilderCollection : IReadOnlyCollection<ISqlConstraintBuilder>, IEnumerable<ISqlConstraintBuilder>, IEnumerable
- Inherited Members
- Extension Methods
Properties
Table
Table that this collection belongs to.
ISqlTableBuilder 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.
CreateCheck(SqlConditionNode)
Creates a new check builder with a default name.
ISqlCheckBuilder CreateCheck(SqlConditionNode condition)
Parameters
condition
SqlConditionNodeUnderlying condition of the check constraint.
Returns
- ISqlCheckBuilder
New ISqlCheckBuilder instance.
Exceptions
- SqlObjectBuilderException
When check constraint could not be created.
CreateCheck(string, SqlConditionNode)
Creates a new check builder.
ISqlCheckBuilder CreateCheck(string name, SqlConditionNode condition)
Parameters
name
stringName of the check constraint.
condition
SqlConditionNodeUnderlying condition of the check constraint.
Returns
- ISqlCheckBuilder
New ISqlCheckBuilder instance.
Exceptions
- SqlObjectBuilderException
When check constraint could not be created.
CreateForeignKey(ISqlIndexBuilder, ISqlIndexBuilder)
Creates a new foreign key builder with a default name.
ISqlForeignKeyBuilder CreateForeignKey(ISqlIndexBuilder originIndex, ISqlIndexBuilder referencedIndex)
Parameters
originIndex
ISqlIndexBuilderSQL index that the foreign key originates from.
referencedIndex
ISqlIndexBuilderSQL index referenced by the foreign key.
Returns
- ISqlForeignKeyBuilder
New ISqlForeignKeyBuilder instance.
Exceptions
- SqlObjectBuilderException
When foreign key constraint could not be created.
CreateForeignKey(string, ISqlIndexBuilder, ISqlIndexBuilder)
Creates a new foreign key builder.
ISqlForeignKeyBuilder CreateForeignKey(string name, ISqlIndexBuilder originIndex, ISqlIndexBuilder referencedIndex)
Parameters
name
stringName of the foreign key constraint.
originIndex
ISqlIndexBuilderSQL index that the foreign key originates from.
referencedIndex
ISqlIndexBuilderSQL index referenced by the foreign key.
Returns
- ISqlForeignKeyBuilder
New ISqlForeignKeyBuilder instance.
Exceptions
- SqlObjectBuilderException
When foreign key constraint could not be created.
CreateIndex(ReadOnlyArray<SqlOrderByNode>, bool)
Creates a new index builder with a default name.
ISqlIndexBuilder CreateIndex(ReadOnlyArray<SqlOrderByNode> columns, bool isUnique = false)
Parameters
columns
ReadOnlyArray<SqlOrderByNode>Collection of columns that define the index.
isUnique
boolSpecifies whether or not the index should start as unique. Equal to false by default.
Returns
- ISqlIndexBuilder
New ISqlIndexBuilder instance.
Exceptions
- SqlObjectBuilderException
When index constraint could not be created.
CreateIndex(string, ReadOnlyArray<SqlOrderByNode>, bool)
Creates a new index builder.
ISqlIndexBuilder CreateIndex(string name, ReadOnlyArray<SqlOrderByNode> columns, bool isUnique = false)
Parameters
name
stringName of the index constraint.
columns
ReadOnlyArray<SqlOrderByNode>Collection of columns that define the index.
isUnique
boolSpecifies whether or not the index should start as unique. Equal to false by default.
Returns
- ISqlIndexBuilder
New ISqlIndexBuilder instance.
Exceptions
- SqlObjectBuilderException
When index constraint could not be created.
Get(string)
Returns a constraint with the provided name
.
[Pure]
ISqlConstraintBuilder Get(string name)
Parameters
name
stringName of the constraint to return.
Returns
- ISqlConstraintBuilder
Existing constraint.
Exceptions
- KeyNotFoundException
When constraint does not exist.
GetCheck(string)
Returns a check with the provided name
.
[Pure]
ISqlCheckBuilder GetCheck(string name)
Parameters
name
stringName of the check to return.
Returns
- ISqlCheckBuilder
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]
ISqlForeignKeyBuilder GetForeignKey(string name)
Parameters
name
stringName of the foreign key to return.
Returns
- ISqlForeignKeyBuilder
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]
ISqlIndexBuilder GetIndex(string name)
Parameters
name
stringName of the index to return.
Returns
- ISqlIndexBuilder
Existing index.
Exceptions
- KeyNotFoundException
When index does not exist.
- SqlObjectCastException
When constraint exists but is not an index.
GetPrimaryKey()
Retrieves a primary key builder.
[Pure]
ISqlPrimaryKeyBuilder GetPrimaryKey()
Returns
- ISqlPrimaryKeyBuilder
Existing primary key builder.
Exceptions
- SqlObjectBuilderException
When primary key builder does not exist.
Remove(string)
Attempts to remove a constraint by its name
.
bool Remove(string name)
Parameters
name
stringName of the constraint to remove.
Returns
- bool
true when constraint was removed, otherwise false.
SetPrimaryKey(ISqlIndexBuilder)
Sets a new primary key builder with a default name.
ISqlPrimaryKeyBuilder SetPrimaryKey(ISqlIndexBuilder index)
Parameters
index
ISqlIndexBuilderUnderlying index that defines the primary key.
Returns
- ISqlPrimaryKeyBuilder
New ISqlPrimaryKeyBuilder instance.
Exceptions
- SqlObjectBuilderException
When primary key constraint could not be created.
SetPrimaryKey(string, ISqlIndexBuilder)
Sets a new primary key builder.
ISqlPrimaryKeyBuilder SetPrimaryKey(string name, ISqlIndexBuilder index)
Parameters
name
stringName of the primary key constraint.
index
ISqlIndexBuilderUnderlying index that defines the primary key.
Returns
- ISqlPrimaryKeyBuilder
New ISqlPrimaryKeyBuilder instance.
Exceptions
- SqlObjectBuilderException
When primary key constraint could not be created.
TryGet(string)
Attempts to return a constraint with the provided name
.
[Pure]
ISqlConstraintBuilder? TryGet(string name)
Parameters
name
stringName of the constraint to return.
Returns
- ISqlConstraintBuilder
Existing constraint or null when constraint does not exist.
TryGetCheck(string)
Attempts to return a check with the provided name
.
[Pure]
ISqlCheckBuilder? TryGetCheck(string name)
Parameters
name
stringName of the check to return.
Returns
- ISqlCheckBuilder
Existing check or null when check does not exist.
TryGetForeignKey(string)
Attempts to return a foreign key with the provided name
.
[Pure]
ISqlForeignKeyBuilder? TryGetForeignKey(string name)
Parameters
name
stringName of the foreign key to return.
Returns
- ISqlForeignKeyBuilder
Existing foreign key or null when foreign key does not exist.
TryGetIndex(string)
Attempts to return an index with the provided name
.
[Pure]
ISqlIndexBuilder? TryGetIndex(string name)
Parameters
name
stringName of the index to return.
Returns
- ISqlIndexBuilder
Existing index or null when index does not exist.
TryGetPrimaryKey()
Attempts to retrieve a primary key builder.
[Pure]
ISqlPrimaryKeyBuilder? TryGetPrimaryKey()
Returns
- ISqlPrimaryKeyBuilder
Existing primary key builder or null when it does not exist.