Table of Contents

Class SqliteConstraintBuilderCollection

Namespace
LfrlAnvil.Sqlite.Objects.Builders
Assembly
LfrlAnvil.Sqlite.dll

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

SqliteTableBuilder

Methods

CreateCheck(SqlConditionNode)

Creates a new check builder with a default name.

public SqliteCheckBuilder CreateCheck(SqlConditionNode condition)

Parameters

condition SqlConditionNode

Underlying 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

name string

Name of the check constraint.

condition SqlConditionNode

Underlying 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

originIndex SqliteIndexBuilder

SQL index that the foreign key originates from.

referencedIndex SqliteIndexBuilder

SQL 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

name string

Name of the foreign key constraint.

originIndex SqliteIndexBuilder

SQL index that the foreign key originates from.

referencedIndex SqliteIndexBuilder

SQL 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

columns ReadOnlyArray<SqlOrderByNode>

Collection of columns that define the index.

isUnique bool

Specifies 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

name string

Name of the index constraint.

columns ReadOnlyArray<SqlOrderByNode>

Collection of columns that define the index.

isUnique bool

Specifies 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

name string

Name 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

name string

Name 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

name string

Name 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

index SqliteIndexBuilder

Underlying 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

name string

Name of the primary key constraint.

index SqliteIndexBuilder

Underlying 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

name string

Name 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

name string

Name 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

name string

Name 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.