Table of Contents

Class SqlSchemaCollection

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

Represents a collection of SQL schemas.

public abstract class SqlSchemaCollection : ISqlSchemaCollection, IReadOnlyCollection<ISqlSchema>, IEnumerable<ISqlSchema>, IEnumerable
Inheritance
SqlSchemaCollection
Implements
Derived
Inherited Members

Constructors

SqlSchemaCollection(SqlSchemaBuilderCollection)

Creates a new SqlSchemaCollection instance.

protected SqlSchemaCollection(SqlSchemaBuilderCollection source)

Parameters

source SqlSchemaBuilderCollection

Source collection.

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 SqlDatabase Database { get; }

Property Value

SqlDatabase

Default

Default schema.

public SqlSchema Default { get; }

Property Value

SqlSchema

Methods

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.

CreateSchema(SqlSchemaBuilder)

Creates a new SqlSchema instance.

[Pure]
protected abstract SqlSchema CreateSchema(SqlSchemaBuilder builder)

Parameters

builder SqlSchemaBuilder

Source schema builder.

Returns

SqlSchema

New SqlSchema instance.

Get(string)

Returns a schema with the provided name.

[Pure]
public SqlSchema Get(string name)

Parameters

name string

Name of the schema to return.

Returns

SqlSchema

Existing schema.

Exceptions

KeyNotFoundException

When schema does not exist.

GetEnumerator()

Creates a new SqlObjectEnumerator<T> instance for this collection.

[Pure]
public SqlObjectEnumerator<SqlSchema> GetEnumerator()

Returns

SqlObjectEnumerator<SqlSchema>

New SqlObjectEnumerator<T> instance.

GetSchemaFromUnknown(SqlObjectBuilder)

Extracts an SqlSchemaBuilder instance from an UnknownSqlObjectBuilder instance.

[Pure]
protected virtual SqlSchemaBuilder GetSchemaFromUnknown(SqlObjectBuilder builder)

Parameters

builder SqlObjectBuilder

Source builder.

Returns

SqlSchemaBuilder

Extracted SqlSchemaBuilder instance.

Exceptions

NotSupportedException

This method is not supported by default.

TryGet(string)

Attempts to return a schema with the provided name.

[Pure]
public SqlSchema? TryGet(string name)

Parameters

name string

Name of the schema to return.

Returns

SqlSchema

Existing schema or null when schema does not exist.