Table of Contents

Class PostgreSqlObjectBuilderCollection

Namespace
LfrlAnvil.PostgreSql.Objects.Builders
Assembly
LfrlAnvil.PostgreSql.dll

Represents a collection of SQL schema object builders.

public sealed class PostgreSqlObjectBuilderCollection : SqlObjectBuilderCollection, ISqlObjectBuilderCollection, IReadOnlyCollection<ISqlObjectBuilder>, IEnumerable<ISqlObjectBuilder>, IEnumerable
Inheritance
PostgreSqlObjectBuilderCollection
Implements
Inherited Members

Remarks

PostgreSqlDialect implementation.

Properties

Schema

Schema that this collection belongs to.

public PostgreSqlSchemaBuilder Schema { get; }

Property Value

PostgreSqlSchemaBuilder

Methods

CreateCheckBuilder(SqlTableBuilder, string, SqlConditionNode, ReadOnlyArray<SqlColumnBuilder>)

Creates a new SqlCheckBuilder instance.

protected override PostgreSqlCheckBuilder CreateCheckBuilder(SqlTableBuilder table, string name, SqlConditionNode condition, ReadOnlyArray<SqlColumnBuilder> referencedColumns)

Parameters

table SqlTableBuilder

Table that this check is attached to.

name string

Check's name.

condition SqlConditionNode

Underlying condition of this check constraint.

referencedColumns ReadOnlyArray<SqlColumnBuilder>

Collection of columns referenced by this check constraint.

Returns

PostgreSqlCheckBuilder

New SqlCheckBuilder instance.

CreateForeignKeyBuilder(string, SqlIndexBuilder, SqlIndexBuilder)

Creates a new SqlForeignKeyBuilder instance.

protected override PostgreSqlForeignKeyBuilder CreateForeignKeyBuilder(string name, SqlIndexBuilder originIndex, SqlIndexBuilder referencedIndex)

Parameters

name string

Foreign key's name.

originIndex SqlIndexBuilder

SQL index that this foreign key originates from.

referencedIndex SqlIndexBuilder

SQL index referenced by this foreign key.

Returns

PostgreSqlForeignKeyBuilder

New SqlForeignKeyBuilder instance.

CreateIndexBuilder(SqlTableBuilder, string, SqlIndexBuilderColumns<SqlColumnBuilder>, bool, ReadOnlyArray<SqlColumnBuilder>)

Creates a new SqlIndexBuilder instance.

protected override PostgreSqlIndexBuilder CreateIndexBuilder(SqlTableBuilder table, string name, SqlIndexBuilderColumns<SqlColumnBuilder> columns, bool isUnique, ReadOnlyArray<SqlColumnBuilder> referencedColumns)

Parameters

table SqlTableBuilder

Table that this index is attached to.

name string

Index's name.

columns SqlIndexBuilderColumns<SqlColumnBuilder>

Collection of columns that define this index.

isUnique bool

Specifies whether or not this index is unique.

referencedColumns ReadOnlyArray<SqlColumnBuilder>

Collection of columns referenced by this index's Columns.

Returns

PostgreSqlIndexBuilder

New SqlIndexBuilder instance.

CreatePrimaryKeyBuilder(string, SqlIndexBuilder)

Creates a new SqlPrimaryKeyBuilder instance.

protected override PostgreSqlPrimaryKeyBuilder CreatePrimaryKeyBuilder(string name, SqlIndexBuilder index)

Parameters

name string

Primary key's name.

index SqlIndexBuilder

Underlying index that defines this primary key.

Returns

PostgreSqlPrimaryKeyBuilder

New SqlPrimaryKeyBuilder instance.

CreateTable(string)

Creates a new table builder.

public PostgreSqlTableBuilder CreateTable(string name)

Parameters

name string

Name of the table.

Returns

PostgreSqlTableBuilder

New ISqlTableBuilder instance.

Exceptions

SqlObjectBuilderException

When table could not be created.

CreateTableBuilder(string)

Creates a new SqlTableBuilder instance.

protected override PostgreSqlTableBuilder CreateTableBuilder(string name)

Parameters

name string

Table's name.

Returns

PostgreSqlTableBuilder

New SqlTableBuilder instance

CreateView(string, SqlQueryExpressionNode)

Creates a new view builder.

public PostgreSqlViewBuilder CreateView(string name, SqlQueryExpressionNode source)

Parameters

name string

Name of the view.

source SqlQueryExpressionNode

Underlying source query expression that defines the view.

Returns

PostgreSqlViewBuilder

New ISqlViewBuilder instance.

Exceptions

SqlObjectBuilderException

When view could not be created.

CreateViewBuilder(string, SqlQueryExpressionNode, ReadOnlyArray<SqlObjectBuilder>)

Creates a new SqlViewBuilder instance.

protected override PostgreSqlViewBuilder CreateViewBuilder(string name, SqlQueryExpressionNode source, ReadOnlyArray<SqlObjectBuilder> referencedObjects)

Parameters

name string

View's name.

source SqlQueryExpressionNode

Underlying source query expression that defines this view.

referencedObjects ReadOnlyArray<SqlObjectBuilder>

Collection of objects (tables, views and columns) referenced by this view's Source.

Returns

PostgreSqlViewBuilder

New SqlViewBuilder instance

GetCheck(string)

Returns a check with the provided name.

[Pure]
public PostgreSqlCheckBuilder GetCheck(string name)

Parameters

name string

Name of the check to return.

Returns

PostgreSqlCheckBuilder

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 PostgreSqlForeignKeyBuilder GetForeignKey(string name)

Parameters

name string

Name of the foreign key to return.

Returns

PostgreSqlForeignKeyBuilder

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 PostgreSqlIndexBuilder GetIndex(string name)

Parameters

name string

Name of the index to return.

Returns

PostgreSqlIndexBuilder

Existing index.

Exceptions

KeyNotFoundException

When index does not exist.

SqlObjectCastException

When object exists but is not an index.

GetOrCreateTable(string)

Creates a new table builder or returns an existing table builder.

public PostgreSqlTableBuilder GetOrCreateTable(string name)

Parameters

name string

Name of the table.

Returns

PostgreSqlTableBuilder

New ISqlTableBuilder instance or an existing table builder.

Exceptions

SqlObjectBuilderException

When table does not exist and could not be created.

GetPrimaryKey(string)

Returns a primary key with the provided name.

[Pure]
public PostgreSqlPrimaryKeyBuilder GetPrimaryKey(string name)

Parameters

name string

Name of the primary key to return.

Returns

PostgreSqlPrimaryKeyBuilder

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 PostgreSqlTableBuilder GetTable(string name)

Parameters

name string

Name of the table to return.

Returns

PostgreSqlTableBuilder

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 PostgreSqlViewBuilder GetView(string name)

Parameters

name string

Name of the view to return.

Returns

PostgreSqlViewBuilder

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 PostgreSqlCheckBuilder? TryGetCheck(string name)

Parameters

name string

Name of the check to return.

Returns

PostgreSqlCheckBuilder

Existing check or null when check does not exist.

TryGetForeignKey(string)

Attempts to return a foreign key with the provided name.

[Pure]
public PostgreSqlForeignKeyBuilder? TryGetForeignKey(string name)

Parameters

name string

Name of the foreign key to return.

Returns

PostgreSqlForeignKeyBuilder

Existing foreign key or null when foreign key does not exist.

TryGetIndex(string)

Attempts to return an index with the provided name.

[Pure]
public PostgreSqlIndexBuilder? TryGetIndex(string name)

Parameters

name string

Name of the index to return.

Returns

PostgreSqlIndexBuilder

Existing index or null when index does not exist.

TryGetPrimaryKey(string)

Attempts to return a primary key with the provided name.

[Pure]
public PostgreSqlPrimaryKeyBuilder? TryGetPrimaryKey(string name)

Parameters

name string

Name of the primary key to return.

Returns

PostgreSqlPrimaryKeyBuilder

Existing primary key or null when primary key does not exist.

TryGetTable(string)

Attempts to return a table with the provided name.

[Pure]
public PostgreSqlTableBuilder? TryGetTable(string name)

Parameters

name string

Name of the table to return.

Returns

PostgreSqlTableBuilder

Existing table or null when table does not exist.

TryGetView(string)

Attempts to return a view with the provided name.

[Pure]
public PostgreSqlViewBuilder? TryGetView(string name)

Parameters

name string

Name of the view to return.

Returns

PostgreSqlViewBuilder

Existing view or null when view does not exist.