Class MySqlObjectBuilderCollection
Represents a collection of SQL schema object builders.
public sealed class MySqlObjectBuilderCollection : SqlObjectBuilderCollection, ISqlObjectBuilderCollection, IReadOnlyCollection<ISqlObjectBuilder>, IEnumerable<ISqlObjectBuilder>, IEnumerable
- Inheritance
-
MySqlObjectBuilderCollection
- Implements
- Inherited Members
Remarks
MySqlDialect implementation.
Properties
Schema
Schema that this collection belongs to.
public MySqlSchemaBuilder Schema { get; }
Property Value
Methods
CreateCheckBuilder(SqlTableBuilder, string, SqlConditionNode, ReadOnlyArray<SqlColumnBuilder>)
Creates a new SqlCheckBuilder instance.
protected override MySqlCheckBuilder CreateCheckBuilder(SqlTableBuilder table, string name, SqlConditionNode condition, ReadOnlyArray<SqlColumnBuilder> referencedColumns)
Parameters
table
SqlTableBuilderTable that this check is attached to.
name
stringCheck's name.
condition
SqlConditionNodeUnderlying condition of this check constraint.
referencedColumns
ReadOnlyArray<SqlColumnBuilder>Collection of columns referenced by this check constraint.
Returns
- MySqlCheckBuilder
New SqlCheckBuilder instance.
CreateForeignKeyBuilder(string, SqlIndexBuilder, SqlIndexBuilder)
Creates a new SqlForeignKeyBuilder instance.
protected override MySqlForeignKeyBuilder CreateForeignKeyBuilder(string name, SqlIndexBuilder originIndex, SqlIndexBuilder referencedIndex)
Parameters
name
stringForeign key's name.
originIndex
SqlIndexBuilderSQL index that this foreign key originates from.
referencedIndex
SqlIndexBuilderSQL index referenced by this foreign key.
Returns
- MySqlForeignKeyBuilder
New SqlForeignKeyBuilder instance.
CreateIndexBuilder(SqlTableBuilder, string, SqlIndexBuilderColumns<SqlColumnBuilder>, bool, ReadOnlyArray<SqlColumnBuilder>)
Creates a new SqlIndexBuilder instance.
protected override MySqlIndexBuilder CreateIndexBuilder(SqlTableBuilder table, string name, SqlIndexBuilderColumns<SqlColumnBuilder> columns, bool isUnique, ReadOnlyArray<SqlColumnBuilder> referencedColumns)
Parameters
table
SqlTableBuilderTable that this index is attached to.
name
stringIndex's name.
columns
SqlIndexBuilderColumns<SqlColumnBuilder>Collection of columns that define this index.
isUnique
boolSpecifies whether or not this index is unique.
referencedColumns
ReadOnlyArray<SqlColumnBuilder>Collection of columns referenced by this index's Columns.
Returns
- MySqlIndexBuilder
New SqlIndexBuilder instance.
CreatePrimaryKeyBuilder(string, SqlIndexBuilder)
Creates a new SqlPrimaryKeyBuilder instance.
protected override MySqlPrimaryKeyBuilder CreatePrimaryKeyBuilder(string name, SqlIndexBuilder index)
Parameters
name
stringPrimary key's name.
index
SqlIndexBuilderUnderlying index that defines this primary key.
Returns
- MySqlPrimaryKeyBuilder
New SqlPrimaryKeyBuilder instance.
CreateTable(string)
Creates a new table builder.
public MySqlTableBuilder CreateTable(string name)
Parameters
name
stringName of the table.
Returns
- MySqlTableBuilder
New ISqlTableBuilder instance.
Exceptions
- SqlObjectBuilderException
When table could not be created.
CreateTableBuilder(string)
Creates a new SqlTableBuilder instance.
protected override MySqlTableBuilder CreateTableBuilder(string name)
Parameters
name
stringTable's name.
Returns
- MySqlTableBuilder
New SqlTableBuilder instance
CreateView(string, SqlQueryExpressionNode)
Creates a new view builder.
public MySqlViewBuilder CreateView(string name, SqlQueryExpressionNode source)
Parameters
name
stringName of the view.
source
SqlQueryExpressionNodeUnderlying source query expression that defines the view.
Returns
- MySqlViewBuilder
New ISqlViewBuilder instance.
Exceptions
- SqlObjectBuilderException
When view could not be created.
CreateViewBuilder(string, SqlQueryExpressionNode, ReadOnlyArray<SqlObjectBuilder>)
Creates a new SqlViewBuilder instance.
protected override MySqlViewBuilder CreateViewBuilder(string name, SqlQueryExpressionNode source, ReadOnlyArray<SqlObjectBuilder> referencedObjects)
Parameters
name
stringView's name.
source
SqlQueryExpressionNodeUnderlying source query expression that defines this view.
referencedObjects
ReadOnlyArray<SqlObjectBuilder>Collection of objects (tables, views and columns) referenced by this view's Source.
Returns
- MySqlViewBuilder
New SqlViewBuilder instance
GetCheck(string)
Returns a check with the provided name
.
[Pure]
public MySqlCheckBuilder GetCheck(string name)
Parameters
name
stringName of the check to return.
Returns
- MySqlCheckBuilder
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 MySqlForeignKeyBuilder GetForeignKey(string name)
Parameters
name
stringName of the foreign key to return.
Returns
- MySqlForeignKeyBuilder
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 MySqlIndexBuilder GetIndex(string name)
Parameters
name
stringName of the index to return.
Returns
- MySqlIndexBuilder
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 MySqlTableBuilder GetOrCreateTable(string name)
Parameters
name
stringName of the table.
Returns
- MySqlTableBuilder
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 MySqlPrimaryKeyBuilder GetPrimaryKey(string name)
Parameters
name
stringName of the primary key to return.
Returns
- MySqlPrimaryKeyBuilder
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 MySqlTableBuilder GetTable(string name)
Parameters
name
stringName of the table to return.
Returns
- MySqlTableBuilder
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 MySqlViewBuilder GetView(string name)
Parameters
name
stringName of the view to return.
Returns
- MySqlViewBuilder
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 MySqlCheckBuilder? TryGetCheck(string name)
Parameters
name
stringName of the check to return.
Returns
- MySqlCheckBuilder
Existing check or null when check does not exist.
TryGetForeignKey(string)
Attempts to return a foreign key with the provided name
.
[Pure]
public MySqlForeignKeyBuilder? TryGetForeignKey(string name)
Parameters
name
stringName of the foreign key to return.
Returns
- MySqlForeignKeyBuilder
Existing foreign key or null when foreign key does not exist.
TryGetIndex(string)
Attempts to return an index with the provided name
.
[Pure]
public MySqlIndexBuilder? TryGetIndex(string name)
Parameters
name
stringName of the index to return.
Returns
- MySqlIndexBuilder
Existing index or null when index does not exist.
TryGetPrimaryKey(string)
Attempts to return a primary key with the provided name
.
[Pure]
public MySqlPrimaryKeyBuilder? TryGetPrimaryKey(string name)
Parameters
name
stringName of the primary key to return.
Returns
- MySqlPrimaryKeyBuilder
Existing primary key or null when primary key does not exist.
TryGetTable(string)
Attempts to return a table with the provided name
.
[Pure]
public MySqlTableBuilder? TryGetTable(string name)
Parameters
name
stringName of the table to return.
Returns
- MySqlTableBuilder
Existing table or null when table does not exist.
TryGetView(string)
Attempts to return a view with the provided name
.
[Pure]
public MySqlViewBuilder? TryGetView(string name)
Parameters
name
stringName of the view to return.
Returns
- MySqlViewBuilder
Existing view or null when view does not exist.