Table of Contents

Class SqlColumnTypeDefinitionProvider

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

Represents a collection of column type definitions.

public abstract class SqlColumnTypeDefinitionProvider : ISqlColumnTypeDefinitionProvider
Inheritance
SqlColumnTypeDefinitionProvider
Implements
Derived
Inherited Members
Extension Methods

Constructors

SqlColumnTypeDefinitionProvider(SqlColumnTypeDefinitionProviderBuilder)

Creates a new SqlColumnTypeDefinitionProvider instance.

protected SqlColumnTypeDefinitionProvider(SqlColumnTypeDefinitionProviderBuilder builder)

Parameters

builder SqlColumnTypeDefinitionProviderBuilder

Source builder.

Fields

IsLocked

Specifies that new registrations are disabled for this provider.

protected bool IsLocked

Field Value

bool

Properties

Dialect

Specifies the SQL dialect of this provider.

public SqlDialect Dialect { get; }

Property Value

SqlDialect

Methods

Contains(ISqlColumnTypeDefinition)

Checks whether or not the specified definition belongs to this provider.

[Pure]
public bool Contains(ISqlColumnTypeDefinition definition)

Parameters

definition ISqlColumnTypeDefinition

Definition to check.

Returns

bool

true when definition belongs to this provider, otherwise false.

CreateEnumTypeDefinition<TEnum, TUnderlying>(SqlColumnTypeDefinition<TUnderlying>)

Creates a new SqlColumnTypeDefinition<T> instance for the TEnum type with TUnderlying type.

[Pure]
protected abstract SqlColumnTypeDefinition<TEnum> CreateEnumTypeDefinition<TEnum, TUnderlying>(SqlColumnTypeDefinition<TUnderlying> underlyingTypeDefinition) where TEnum : struct, Enum where TUnderlying : unmanaged

Parameters

underlyingTypeDefinition SqlColumnTypeDefinition<TUnderlying>

Column type definition associated with the underlying type.

Returns

SqlColumnTypeDefinition<TEnum>

New SqlColumnTypeDefinition<T> instance.

Type Parameters

TEnum

Enum type.

TUnderlying

Type of the underlying value of TEnum type.

GetByDataType(ISqlDataType)

Returns a default column type definition associated with the provided dataType.

[Pure]
public abstract SqlColumnTypeDefinition GetByDataType(ISqlDataType type)

Parameters

type ISqlDataType

Returns

SqlColumnTypeDefinition

Default column type definition associated with the provided dataType.

GetByType(Type)

Returns a column type definition associated with the provided type.

[Pure]
public SqlColumnTypeDefinition GetByType(Type type)

Parameters

type Type

Runtime type to get type definition for.

Returns

SqlColumnTypeDefinition

Column type definition associated with the provided type.

Exceptions

KeyNotFoundException

When column type definition for the provided type does not exist.

GetDataTypeDefinitions()

Returns a collection of all default column type definitions identifiable by ISqlDataType instances.

[Pure]
public abstract IReadOnlyCollection<SqlColumnTypeDefinition> GetDataTypeDefinitions()

Returns

IReadOnlyCollection<SqlColumnTypeDefinition>

Collection of all default column type definitions identifiable by ISqlDataType instances.

GetTypeDefinitions()

Returns a collection of all column type definitions identifiable by Type instances.

[Pure]
public IReadOnlyCollection<SqlColumnTypeDefinition> GetTypeDefinitions()

Returns

IReadOnlyCollection<SqlColumnTypeDefinition>

Collection of all column type definitions identifiable by Type instances.

TryAddDefinition(SqlColumnTypeDefinition)

Attempts to add a new column type definition.

protected bool TryAddDefinition(SqlColumnTypeDefinition definition)

Parameters

definition SqlColumnTypeDefinition

Definition to add.

Returns

bool

true when definition was added, otherwise false.

TryCreateUnknownTypeDefinition(Type)

Attempts to create a new SqlColumnTypeDefinition instance associated with the provided type to dynamically register.

[Pure]
protected virtual SqlColumnTypeDefinition? TryCreateUnknownTypeDefinition(Type type)

Parameters

type Type

Type to register.

Returns

SqlColumnTypeDefinition

New SqlColumnTypeDefinition or null when column type definition for the provided type should not be dynamically registered.

TryGetByType(Type)

Attempts to return a column type definition associated with the provided type.

[Pure]
public SqlColumnTypeDefinition? TryGetByType(Type type)

Parameters

type Type

Runtime type to get type definition for.

Returns

SqlColumnTypeDefinition

Column type definition associated with the provided type or null when column type definition for the provided type does not exist.