Table of Contents

Class SqlSchemaBuilderCollection

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

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

SqlDatabaseBuilder

Default

Default schema.

public SqlSchemaBuilder Default { get; }

Property Value

SqlSchemaBuilder

Methods

AfterCreateSchema(SqlSchemaBuilder)

Callback invoked just after the schema creation has been processed.

protected virtual void AfterCreateSchema(SqlSchemaBuilder schema)

Parameters

schema SqlSchemaBuilder

Created schema.

Contains(string)

Checks whether or not a schema with the provided name exists.

[Pure]
public bool Contains(string name)

Parameters

name string

Name to check.

Returns

bool

true when schema exists, otherwise false.

Create(string)

Creates a new schema builder.

public SqlSchemaBuilder Create(string name)

Parameters

name string

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

Schema's name.

Returns

SqlSchemaBuilder

New SqlSchemaBuilder instance.

Get(string)

Returns a schema with the provided name.

[Pure]
public SqlSchemaBuilder Get(string name)

Parameters

name string

Name 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

SqlObjectBuilderEnumerator<SqlSchemaBuilder>

New SqlObjectBuilderEnumerator<T> instance.

GetOrCreate(string)

Creates a new schema builder or returns an existing schema builder.

public SqlSchemaBuilder GetOrCreate(string name)

Parameters

name string

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

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

Name of the schema to return.

Returns

SqlSchemaBuilder

Existing schema or null when schema does not exist.