Class SqlSchemaBuilderCollection
Represents a collection of SQL schema builders.
public abstract class SqlSchemaBuilderCollection : SqlBuilderApi, ISqlSchemaBuilderCollection, IReadOnlyCollection<ISqlSchemaBuilder>, IEnumerable<ISqlSchemaBuilder>, IEnumerable
- Inheritance
-
SqlSchemaBuilderCollection
- Implements
- Derived
- Inherited Members
Constructors
SqlSchemaBuilderCollection()
Creates a new empty SqlSchemaBuilderCollection instance.
protected SqlSchemaBuilderCollection()
Properties
Count
Gets the number of elements in the collection.
public int Count { get; }
Property Value
- int
The number of elements in the collection.
Database
Database that this collection belongs to.
public SqlDatabaseBuilder Database { get; }
Property Value
Default
Default schema.
public SqlSchemaBuilder Default { get; }
Property Value
Methods
AfterCreateSchema(SqlSchemaBuilder)
Callback invoked just after the schema
creation has been processed.
protected virtual void AfterCreateSchema(SqlSchemaBuilder schema)
Parameters
schema
SqlSchemaBuilderCreated schema.
Contains(string)
Checks whether or not a schema with the provided name
exists.
[Pure]
public bool Contains(string name)
Parameters
name
stringName to check.
Returns
- bool
true when schema exists, otherwise false.
Create(string)
Creates a new schema builder.
public SqlSchemaBuilder Create(string name)
Parameters
name
stringName of the schema.
Returns
- SqlSchemaBuilder
New ISqlSchemaBuilder instance.
Exceptions
- SqlObjectBuilderException
When schema could not be created.
CreateSchemaBuilder(string)
Creates a new SqlSchemaBuilder instance.
protected abstract SqlSchemaBuilder CreateSchemaBuilder(string name)
Parameters
name
stringSchema's name.
Returns
- SqlSchemaBuilder
New SqlSchemaBuilder instance.
Get(string)
Returns a schema with the provided name
.
[Pure]
public SqlSchemaBuilder Get(string name)
Parameters
name
stringName of the schema to return.
Returns
- SqlSchemaBuilder
Existing schema.
Exceptions
- KeyNotFoundException
When schema does not exist.
GetEnumerator()
Creates a new SqlObjectBuilderEnumerator<T> instance for this collection.
[Pure]
public SqlObjectBuilderEnumerator<SqlSchemaBuilder> GetEnumerator()
Returns
GetOrCreate(string)
Creates a new schema builder or returns an existing schema builder.
public SqlSchemaBuilder GetOrCreate(string name)
Parameters
name
stringName of the schema.
Returns
- SqlSchemaBuilder
New ISqlSchemaBuilder instance or an existing schema builder.
Exceptions
- SqlObjectBuilderException
When schema does not exist and could not be created.
Remove(string)
Attempts to remove a schema by its name
.
public bool Remove(string name)
Parameters
name
stringName of the schema to remove.
Returns
- bool
true when schema was removed, otherwise false.
TryGet(string)
Attempts to return a schema with the provided name
.
[Pure]
public SqlSchemaBuilder? TryGet(string name)
Parameters
name
stringName of the schema to return.
Returns
- SqlSchemaBuilder
Existing schema or null when schema does not exist.