Table of Contents

Class MySqlConstraintCollection

Namespace
LfrlAnvil.MySql.Objects
Assembly
LfrlAnvil.MySql.dll

Represents a collection of SQL table constraints.

public sealed class MySqlConstraintCollection : SqlConstraintCollection, ISqlConstraintCollection, IReadOnlyCollection<ISqlConstraint>, IEnumerable<ISqlConstraint>, IEnumerable
Inheritance
MySqlConstraintCollection
Implements
Inherited Members

Remarks

MySqlDialect implementation.

Properties

PrimaryKey

Table's primary key constraint.

public MySqlPrimaryKey PrimaryKey { get; }

Property Value

MySqlPrimaryKey

Table

Table that this collection belongs to.

public MySqlTable Table { get; }

Property Value

MySqlTable

Methods

GetCheck(string)

Returns a check with the provided name.

[Pure]
public MySqlCheck GetCheck(string name)

Parameters

name string

Name of the check to return.

Returns

MySqlCheck

Existing check.

Exceptions

KeyNotFoundException

When check does not exist.

SqlObjectCastException

When constraint exists but is not a check.

GetForeignKey(string)

Returns a foreign key with the provided name.

[Pure]
public MySqlForeignKey GetForeignKey(string name)

Parameters

name string

Name of the foreign key to return.

Returns

MySqlForeignKey

Existing foreign key.

Exceptions

KeyNotFoundException

When foreign key does not exist.

SqlObjectCastException

When constraint exists but is not a foreign key.

GetIndex(string)

Returns an index with the provided name.

[Pure]
public MySqlIndex GetIndex(string name)

Parameters

name string

Name of the index to return.

Returns

MySqlIndex

Existing index.

Exceptions

KeyNotFoundException

When index does not exist.

SqlObjectCastException

When constraint exists but is not an index.

TryGetCheck(string)

Attempts to return a check with the provided name.

[Pure]
public MySqlCheck? TryGetCheck(string name)

Parameters

name string

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

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

Name of the index to return.

Returns

MySqlIndex

Existing index or null when index does not exist.