Class MySqlObjectCollection
Represents a collection of SQL schema objects.
public sealed class MySqlObjectCollection : SqlObjectCollection, ISqlObjectCollection, IReadOnlyCollection<ISqlObject>, IEnumerable<ISqlObject>, IEnumerable
- Inheritance
-
MySqlObjectCollection
- Implements
- Inherited Members
Remarks
MySqlDialect implementation.
Properties
Schema
Schema that this collection belongs to.
public MySqlSchema Schema { get; }
Property Value
Methods
CreateCheck(SqlTable, SqlCheckBuilder)
Creates a new SqlCheck instance.
[Pure]
protected override MySqlCheck CreateCheck(SqlTable table, SqlCheckBuilder builder)
Parameters
table
SqlTableTable that this check constraint is attached to.
builder
SqlCheckBuilderSource check builder.
Returns
- MySqlCheck
New SqlCheck instance.
CreateForeignKey(SqlIndex, SqlIndex, SqlForeignKeyBuilder)
Creates a new SqlForeignKey instance.
[Pure]
protected override MySqlForeignKey CreateForeignKey(SqlIndex originIndex, SqlIndex referencedIndex, SqlForeignKeyBuilder builder)
Parameters
originIndex
SqlIndexSQL index that this foreign key originates from.
referencedIndex
SqlIndexSQL index referenced by this foreign key.
builder
SqlForeignKeyBuilderSource foreign key builder.
Returns
- MySqlForeignKey
New SqlForeignKey instance.
CreateIndex(SqlTable, SqlIndexBuilder)
Creates a new SqlIndex instance.
[Pure]
protected override MySqlIndex CreateIndex(SqlTable table, SqlIndexBuilder builder)
Parameters
table
SqlTableTable that this index belongs to.
builder
SqlIndexBuilderSource index builder.
Returns
- MySqlIndex
New SqlIndex instance.
CreatePrimaryKey(SqlIndex, SqlPrimaryKeyBuilder)
Creates a new SqlPrimaryKey instance.
[Pure]
protected override MySqlPrimaryKey CreatePrimaryKey(SqlIndex index, SqlPrimaryKeyBuilder builder)
Parameters
index
SqlIndexUnderlying index that defines this primary key.
builder
SqlPrimaryKeyBuilderSource primary key builder.
Returns
- MySqlPrimaryKey
New SqlPrimaryKey instance.
CreateTable(SqlTableBuilder)
Creates a new SqlTable instance.
[Pure]
protected override MySqlTable CreateTable(SqlTableBuilder builder)
Parameters
builder
SqlTableBuilderSource table builder.
Returns
- MySqlTable
New SqlTable instance.
CreateView(SqlViewBuilder)
Creates a new SqlView instance.
[Pure]
protected override MySqlView CreateView(SqlViewBuilder builder)
Parameters
builder
SqlViewBuilderSource view builder.
Returns
GetCheck(string)
Returns a check with the provided name
.
[Pure]
public MySqlCheck GetCheck(string name)
Parameters
name
stringName of the check to return.
Returns
- MySqlCheck
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 MySqlForeignKey GetForeignKey(string name)
Parameters
name
stringName of the foreign key to return.
Returns
- MySqlForeignKey
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 MySqlIndex GetIndex(string name)
Parameters
name
stringName of the index to return.
Returns
- MySqlIndex
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 MySqlPrimaryKey GetPrimaryKey(string name)
Parameters
name
stringName of the primary key to return.
Returns
- MySqlPrimaryKey
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 MySqlTable GetTable(string name)
Parameters
name
stringName of the table to return.
Returns
- MySqlTable
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 MySqlView GetView(string name)
Parameters
name
stringName of the view to return.
Returns
- MySqlView
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 MySqlCheck? TryGetCheck(string name)
Parameters
name
stringName of the check to return.
Returns
- MySqlCheck
Existing check or null when check does not exist.
TryGetForeignKey(string)
Attempts to return a foreign key with the provided name
.
[Pure]
public MySqlForeignKey? TryGetForeignKey(string name)
Parameters
name
stringName of the foreign key to return.
Returns
- MySqlForeignKey
Existing foreign key or null when foreign key does not exist.
TryGetIndex(string)
Attempts to return an index with the provided name
.
[Pure]
public MySqlIndex? TryGetIndex(string name)
Parameters
name
stringName of the index to return.
Returns
- MySqlIndex
Existing index or null when index does not exist.
TryGetPrimaryKey(string)
Attempts to return a primary key with the provided name
.
[Pure]
public MySqlPrimaryKey? TryGetPrimaryKey(string name)
Parameters
name
stringName of the primary key to return.
Returns
- MySqlPrimaryKey
Existing primary key or null when primary key does not exist.
TryGetTable(string)
Attempts to return a table with the provided name
.
[Pure]
public MySqlTable? TryGetTable(string name)
Parameters
name
stringName of the table to return.
Returns
- MySqlTable
Existing table or null when table does not exist.
TryGetView(string)
Attempts to return a view with the provided name
.
[Pure]
public MySqlView? TryGetView(string name)
Parameters
name
stringName of the view to return.
Returns
- MySqlView
Existing view or null when view does not exist.