Class SqliteConstraintBuilderCollection
Represents a collection of SQL table constraint builders.
public sealed class SqliteConstraintBuilderCollection : SqlConstraintBuilderCollection, ISqlConstraintBuilderCollection, IReadOnlyCollection<ISqlConstraintBuilder>, IEnumerable<ISqlConstraintBuilder>, IEnumerable
- Inheritance
-
SqliteConstraintBuilderCollection
- Implements
- Inherited Members
- Extension Methods
Remarks
SqliteDialect implementation.
Properties
Table
Table that this collection belongs to.
public SqliteTableBuilder Table { get; }
Property Value
Methods
CreateCheck(SqlConditionNode)
Creates a new check builder with a default name.
public SqliteCheckBuilder CreateCheck(SqlConditionNode condition)
Parameters
conditionSqlConditionNodeUnderlying condition of the check constraint.
Returns
- SqliteCheckBuilder
New ISqlCheckBuilder instance.
Exceptions
- SqlObjectBuilderException
When check constraint could not be created.
CreateCheck(string, SqlConditionNode)
Creates a new check builder.
public SqliteCheckBuilder CreateCheck(string name, SqlConditionNode condition)
Parameters
namestringName of the check constraint.
conditionSqlConditionNodeUnderlying condition of the check constraint.
Returns
- SqliteCheckBuilder
New ISqlCheckBuilder instance.
Exceptions
- SqlObjectBuilderException
When check constraint could not be created.
CreateForeignKey(SqliteIndexBuilder, SqliteIndexBuilder)
Creates a new foreign key builder with a default name.
public SqliteForeignKeyBuilder CreateForeignKey(SqliteIndexBuilder originIndex, SqliteIndexBuilder referencedIndex)
Parameters
originIndexSqliteIndexBuilderSQL index that the foreign key originates from.
referencedIndexSqliteIndexBuilderSQL index referenced by the foreign key.
Returns
- SqliteForeignKeyBuilder
New ISqlForeignKeyBuilder instance.
Exceptions
- SqlObjectBuilderException
When foreign key constraint could not be created.
CreateForeignKey(string, SqliteIndexBuilder, SqliteIndexBuilder)
Creates a new foreign key builder.
public SqliteForeignKeyBuilder CreateForeignKey(string name, SqliteIndexBuilder originIndex, SqliteIndexBuilder referencedIndex)
Parameters
namestringName of the foreign key constraint.
originIndexSqliteIndexBuilderSQL index that the foreign key originates from.
referencedIndexSqliteIndexBuilderSQL index referenced by the foreign key.
Returns
- SqliteForeignKeyBuilder
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.
public SqliteIndexBuilder CreateIndex(ReadOnlyArray<SqlOrderByNode> columns, bool isUnique = false)
Parameters
columnsReadOnlyArray<SqlOrderByNode>Collection of columns that define the index.
isUniqueboolSpecifies whether the index should start as unique. Equal to false by default.
Returns
- SqliteIndexBuilder
New ISqlIndexBuilder instance.
Exceptions
- SqlObjectBuilderException
When index constraint could not be created.
CreateIndex(string, ReadOnlyArray<SqlOrderByNode>, bool)
Creates a new index builder.
public SqliteIndexBuilder CreateIndex(string name, ReadOnlyArray<SqlOrderByNode> columns, bool isUnique = false)
Parameters
namestringName of the index constraint.
columnsReadOnlyArray<SqlOrderByNode>Collection of columns that define the index.
isUniqueboolSpecifies whether the index should start as unique. Equal to false by default.
Returns
- SqliteIndexBuilder
New ISqlIndexBuilder instance.
Exceptions
- SqlObjectBuilderException
When index constraint could not be created.
GetCheck(string)
Returns a check with the provided name.
[Pure]
public SqliteCheckBuilder GetCheck(string name)
Parameters
namestringName of the check to return.
Returns
- SqliteCheckBuilder
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 SqliteForeignKeyBuilder GetForeignKey(string name)
Parameters
namestringName of the foreign key to return.
Returns
- SqliteForeignKeyBuilder
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 SqliteIndexBuilder GetIndex(string name)
Parameters
namestringName of the index to return.
Returns
- SqliteIndexBuilder
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]
public SqlitePrimaryKeyBuilder GetPrimaryKey()
Returns
- SqlitePrimaryKeyBuilder
Existing primary key builder.
Exceptions
- SqlObjectBuilderException
When primary key builder does not exist.
SetPrimaryKey(SqliteIndexBuilder)
Sets a new primary key builder with a default name.
public SqlitePrimaryKeyBuilder SetPrimaryKey(SqliteIndexBuilder index)
Parameters
indexSqliteIndexBuilderUnderlying index that defines the primary key.
Returns
- SqlitePrimaryKeyBuilder
New ISqlPrimaryKeyBuilder instance.
Exceptions
- SqlObjectBuilderException
When primary key constraint could not be created.
SetPrimaryKey(string, SqliteIndexBuilder)
Sets a new primary key builder.
public SqlitePrimaryKeyBuilder SetPrimaryKey(string name, SqliteIndexBuilder index)
Parameters
namestringName of the primary key constraint.
indexSqliteIndexBuilderUnderlying index that defines the primary key.
Returns
- SqlitePrimaryKeyBuilder
New ISqlPrimaryKeyBuilder instance.
Exceptions
- SqlObjectBuilderException
When primary key constraint could not be created.
TryGetCheck(string)
Attempts to return a check with the provided name.
[Pure]
public SqliteCheckBuilder? TryGetCheck(string name)
Parameters
namestringName of the check to return.
Returns
- SqliteCheckBuilder
Existing check or null when check does not exist.
TryGetForeignKey(string)
Attempts to return a foreign key with the provided name.
[Pure]
public SqliteForeignKeyBuilder? TryGetForeignKey(string name)
Parameters
namestringName of the foreign key to return.
Returns
- SqliteForeignKeyBuilder
Existing foreign key or null when foreign key does not exist.
TryGetIndex(string)
Attempts to return an index with the provided name.
[Pure]
public SqliteIndexBuilder? TryGetIndex(string name)
Parameters
namestringName of the index to return.
Returns
- SqliteIndexBuilder
Existing index or null when index does not exist.
TryGetPrimaryKey()
Attempts to retrieve a primary key builder.
[Pure]
public SqlitePrimaryKeyBuilder? TryGetPrimaryKey()
Returns
- SqlitePrimaryKeyBuilder
Existing primary key builder or null when it does not exist.