Class PostgreSqlObjectCollection
- Namespace
- LfrlAnvil.PostgreSql.Objects
- Assembly
- LfrlAnvil.PostgreSql.dll
Represents a collection of SQL schema objects.
public sealed class PostgreSqlObjectCollection : SqlObjectCollection, ISqlObjectCollection, IReadOnlyCollection<ISqlObject>, IEnumerable<ISqlObject>, IEnumerable
- Inheritance
-
PostgreSqlObjectCollection
- Implements
- Inherited Members
Remarks
PostgreSqlDialect implementation.
Properties
Schema
Schema that this collection belongs to.
public PostgreSqlSchema Schema { get; }
Property Value
Methods
CreateCheck(SqlTable, SqlCheckBuilder)
Creates a new SqlCheck instance.
[Pure]
protected override PostgreSqlCheck CreateCheck(SqlTable table, SqlCheckBuilder builder)
Parameters
tableSqlTableTable that this check constraint is attached to.
builderSqlCheckBuilderSource check builder.
Returns
- PostgreSqlCheck
New SqlCheck instance.
CreateForeignKey(SqlIndex, SqlIndex, SqlForeignKeyBuilder)
Creates a new SqlForeignKey instance.
[Pure]
protected override PostgreSqlForeignKey CreateForeignKey(SqlIndex originIndex, SqlIndex referencedIndex, SqlForeignKeyBuilder builder)
Parameters
originIndexSqlIndexSQL index that this foreign key originates from.
referencedIndexSqlIndexSQL index referenced by this foreign key.
builderSqlForeignKeyBuilderSource foreign key builder.
Returns
- PostgreSqlForeignKey
New SqlForeignKey instance.
CreateIndex(SqlTable, SqlIndexBuilder)
Creates a new SqlIndex instance.
[Pure]
protected override PostgreSqlIndex CreateIndex(SqlTable table, SqlIndexBuilder builder)
Parameters
tableSqlTableTable that this index belongs to.
builderSqlIndexBuilderSource index builder.
Returns
- PostgreSqlIndex
New SqlIndex instance.
CreatePrimaryKey(SqlIndex, SqlPrimaryKeyBuilder)
Creates a new SqlPrimaryKey instance.
[Pure]
protected override PostgreSqlPrimaryKey CreatePrimaryKey(SqlIndex index, SqlPrimaryKeyBuilder builder)
Parameters
indexSqlIndexUnderlying index that defines this primary key.
builderSqlPrimaryKeyBuilderSource primary key builder.
Returns
- PostgreSqlPrimaryKey
New SqlPrimaryKey instance.
CreateTable(SqlTableBuilder)
Creates a new SqlTable instance.
[Pure]
protected override PostgreSqlTable CreateTable(SqlTableBuilder builder)
Parameters
builderSqlTableBuilderSource table builder.
Returns
- PostgreSqlTable
New SqlTable instance.
CreateView(SqlViewBuilder)
Creates a new SqlView instance.
[Pure]
protected override PostgreSqlView CreateView(SqlViewBuilder builder)
Parameters
builderSqlViewBuilderSource view builder.
Returns
- PostgreSqlView
New SqlView instance.
GetCheck(string)
Returns a check with the provided name.
[Pure]
public PostgreSqlCheck GetCheck(string name)
Parameters
namestringName of the check to return.
Returns
- PostgreSqlCheck
Existing check.
Exceptions
- KeyNotFoundException
When check does not exist.
- SqlObjectCastException
When object exists but is not a check.
GetForeignKey(string)
Returns a foreign key with the provided name.
[Pure]
public PostgreSqlForeignKey GetForeignKey(string name)
Parameters
namestringName of the foreign key to return.
Returns
- PostgreSqlForeignKey
Existing foreign key.
Exceptions
- KeyNotFoundException
When foreign key does not exist.
- SqlObjectCastException
When object exists but is not a foreign key.
GetIndex(string)
Returns an index with the provided name.
[Pure]
public PostgreSqlIndex GetIndex(string name)
Parameters
namestringName of the index to return.
Returns
- PostgreSqlIndex
Existing index.
Exceptions
- KeyNotFoundException
When index does not exist.
- SqlObjectCastException
When object exists but is not an index.
GetPrimaryKey(string)
Returns a primary key with the provided name.
[Pure]
public PostgreSqlPrimaryKey GetPrimaryKey(string name)
Parameters
namestringName of the primary key to return.
Returns
- PostgreSqlPrimaryKey
Existing primary key.
Exceptions
- KeyNotFoundException
When primary key does not exist.
- SqlObjectCastException
When object exists but is not a primary key.
GetTable(string)
Returns a table with the provided name.
[Pure]
public PostgreSqlTable GetTable(string name)
Parameters
namestringName of the table to return.
Returns
- PostgreSqlTable
Existing table.
Exceptions
- KeyNotFoundException
When table does not exist.
- SqlObjectCastException
When object exists but is not a table.
GetView(string)
Returns a view with the provided name.
[Pure]
public PostgreSqlView GetView(string name)
Parameters
namestringName of the view to return.
Returns
- PostgreSqlView
Existing view.
Exceptions
- KeyNotFoundException
When view does not exist.
- SqlObjectCastException
When object exists but is not a view.
TryGetCheck(string)
Attempts to return a check with the provided name.
[Pure]
public PostgreSqlCheck? TryGetCheck(string name)
Parameters
namestringName 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
namestringName 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
namestringName of the index to return.
Returns
- PostgreSqlIndex
Existing index or null when index does not exist.
TryGetPrimaryKey(string)
Attempts to return a primary key with the provided name.
[Pure]
public PostgreSqlPrimaryKey? TryGetPrimaryKey(string name)
Parameters
namestringName of the primary key to return.
Returns
- PostgreSqlPrimaryKey
Existing primary key or null when primary key does not exist.
TryGetTable(string)
Attempts to return a table with the provided name.
[Pure]
public PostgreSqlTable? TryGetTable(string name)
Parameters
namestringName of the table to return.
Returns
- PostgreSqlTable
Existing table or null when table does not exist.
TryGetView(string)
Attempts to return a view with the provided name.
[Pure]
public PostgreSqlView? TryGetView(string name)
Parameters
namestringName of the view to return.
Returns
- PostgreSqlView
Existing view or null when view does not exist.