Table of Contents

Interface ISqlObjectBuilderCollection

Namespace
LfrlAnvil.Sql.Objects.Builders
Assembly
LfrlAnvil.Sql.Core.dll

Represents a collection of SQL schema object builders.

public interface ISqlObjectBuilderCollection : IReadOnlyCollection<ISqlObjectBuilder>, IEnumerable<ISqlObjectBuilder>, IEnumerable
Inherited Members

Properties

Schema

Schema that this collection belongs to.

ISqlSchemaBuilder Schema { get; }

Property Value

ISqlSchemaBuilder

Methods

Contains(string)

Checks whether or not an object with the provided name exists.

[Pure]
bool Contains(string name)

Parameters

name string

Name to check.

Returns

bool

true when object exists, otherwise false.

CreateTable(string)

Creates a new table builder.

ISqlTableBuilder CreateTable(string name)

Parameters

name string

Name of the table.

Returns

ISqlTableBuilder

New ISqlTableBuilder instance.

Exceptions

SqlObjectBuilderException

When table could not be created.

CreateView(string, SqlQueryExpressionNode)

Creates a new view builder.

ISqlViewBuilder CreateView(string name, SqlQueryExpressionNode source)

Parameters

name string

Name of the view.

source SqlQueryExpressionNode

Underlying source query expression that defines the view.

Returns

ISqlViewBuilder

New ISqlViewBuilder instance.

Exceptions

SqlObjectBuilderException

When view could not be created.

Get(string)

Returns an object with the provided name.

[Pure]
ISqlObjectBuilder Get(string name)

Parameters

name string

Name of the object to return.

Returns

ISqlObjectBuilder

Existing object.

Exceptions

KeyNotFoundException

When object does not exist.

GetCheck(string)

Returns a check with the provided name.

[Pure]
ISqlCheckBuilder GetCheck(string name)

Parameters

name string

Name of the check to return.

Returns

ISqlCheckBuilder

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

Parameters

name string

Name of the foreign key to return.

Returns

ISqlForeignKeyBuilder

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

Parameters

name string

Name of the index to return.

Returns

ISqlIndexBuilder

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.

ISqlTableBuilder GetOrCreateTable(string name)

Parameters

name string

Name of the table.

Returns

ISqlTableBuilder

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]
ISqlPrimaryKeyBuilder GetPrimaryKey(string name)

Parameters

name string

Name of the primary key to return.

Returns

ISqlPrimaryKeyBuilder

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

Parameters

name string

Name of the table to return.

Returns

ISqlTableBuilder

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

Parameters

name string

Name of the view to return.

Returns

ISqlViewBuilder

Existing view.

Exceptions

KeyNotFoundException

When view does not exist.

SqlObjectCastException

When object exists but is not a view.

Remove(string)

Attempts to remove an object by its name.

bool Remove(string name)

Parameters

name string

Name of the object to remove.

Returns

bool

true when object was removed, otherwise false.

TryGet(string)

Attempts to return an object with the provided name.

[Pure]
ISqlObjectBuilder? TryGet(string name)

Parameters

name string

Name of the object to return.

Returns

ISqlObjectBuilder

Existing object or null when object does not exist.

TryGetCheck(string)

Attempts to return a check with the provided name.

[Pure]
ISqlCheckBuilder? TryGetCheck(string name)

Parameters

name string

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

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

Name of the index to return.

Returns

ISqlIndexBuilder

Existing index or null when index does not exist.

TryGetPrimaryKey(string)

Attempts to return a primary key with the provided name.

[Pure]
ISqlPrimaryKeyBuilder? TryGetPrimaryKey(string name)

Parameters

name string

Name of the primary key to return.

Returns

ISqlPrimaryKeyBuilder

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

TryGetTable(string)

Attempts to return a table with the provided name.

[Pure]
ISqlTableBuilder? TryGetTable(string name)

Parameters

name string

Name of the table to return.

Returns

ISqlTableBuilder

Existing table or null when table does not exist.

TryGetView(string)

Attempts to return a view with the provided name.

[Pure]
ISqlViewBuilder? TryGetView(string name)

Parameters

name string

Name of the view to return.

Returns

ISqlViewBuilder

Existing view or null when view does not exist.