Table of Contents

Interface ISqlObjectCollection

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

Represents a collection of SQL schema objects.

public interface ISqlObjectCollection : IReadOnlyCollection<ISqlObject>, IEnumerable<ISqlObject>, IEnumerable
Inherited Members

Properties

Schema

Schema that this collection belongs to.

ISqlSchema Schema { get; }

Property Value

ISqlSchema

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.

Get(string)

Returns an object with the provided name.

[Pure]
ISqlObject Get(string name)

Parameters

name string

Name of the object to return.

Returns

ISqlObject

Existing object.

Exceptions

KeyNotFoundException

When object does not exist.

GetCheck(string)

Returns a check with the provided name.

[Pure]
ISqlCheck GetCheck(string name)

Parameters

name string

Name of the check to return.

Returns

ISqlCheck

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

Parameters

name string

Name of the foreign key to return.

Returns

ISqlForeignKey

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

Parameters

name string

Name of the index to return.

Returns

ISqlIndex

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

Parameters

name string

Name of the primary key to return.

Returns

ISqlPrimaryKey

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

Parameters

name string

Name of the table to return.

Returns

ISqlTable

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

Parameters

name string

Name of the view to return.

Returns

ISqlView

Existing view.

Exceptions

KeyNotFoundException

When view does not exist.

SqlObjectCastException

When object exists but is not a view.

TryGet(string)

Attempts to return an object with the provided name.

[Pure]
ISqlObject? TryGet(string name)

Parameters

name string

Name of the object to return.

Returns

ISqlObject

Existing object or null when object does not exist.

TryGetCheck(string)

Attempts to return a check with the provided name.

[Pure]
ISqlCheck? TryGetCheck(string name)

Parameters

name string

Name of the check to return.

Returns

ISqlCheck

Existing check or null when check does not exist.

TryGetForeignKey(string)

Attempts to return a foreign key with the provided name.

[Pure]
ISqlForeignKey? TryGetForeignKey(string name)

Parameters

name string

Name of the foreign key to return.

Returns

ISqlForeignKey

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

TryGetIndex(string)

Attempts to return an index with the provided name.

[Pure]
ISqlIndex? TryGetIndex(string name)

Parameters

name string

Name of the index to return.

Returns

ISqlIndex

Existing index or null when index does not exist.

TryGetPrimaryKey(string)

Attempts to return a primary key with the provided name.

[Pure]
ISqlPrimaryKey? TryGetPrimaryKey(string name)

Parameters

name string

Name of the primary key to return.

Returns

ISqlPrimaryKey

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

TryGetTable(string)

Attempts to return a table with the provided name.

[Pure]
ISqlTable? TryGetTable(string name)

Parameters

name string

Name of the table to return.

Returns

ISqlTable

Existing table or null when table does not exist.

TryGetView(string)

Attempts to return a view with the provided name.

[Pure]
ISqlView? TryGetView(string name)

Parameters

name string

Name of the view to return.

Returns

ISqlView

Existing view or null when view does not exist.