Table of Contents

Class SqlColumnTypeDefinition

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

Represents a type-erased definition of a column type.

public abstract class SqlColumnTypeDefinition : ISqlColumnTypeDefinition
Inheritance
SqlColumnTypeDefinition
Implements
Derived
Inherited Members
Extension Methods

Properties

DataType

Underlying DB data type.

public ISqlDataType DataType { get; }

Property Value

ISqlDataType

DefaultValue

Specifies the default value for this type.

public SqlLiteralNode DefaultValue { get; }

Property Value

SqlLiteralNode

OutputMapping

Specifies the mapping of values read by IDataReader to objects of the specified RuntimeType. This LambdaExpression should have two parameters, where the first represents an IDataReader instance and the second represents an ordinal of the field from which to read the value.

public LambdaExpression OutputMapping { get; }

Property Value

LambdaExpression

RuntimeType

Underlying .NET type.

public abstract Type RuntimeType { get; }

Property Value

Type

Methods

SetParameterInfo(IDbDataParameter, bool)

Updates information of the provided parameter with this type's definition.

public abstract void SetParameterInfo(IDbDataParameter parameter, bool isNullable)

Parameters

parameter IDbDataParameter

Parameter to update.

isNullable bool

Specifies whether or not the parameter should be marked as nullable.

ToString()

Returns a string representation of this SqlColumnTypeDefinition instance.

[Pure]
public override sealed string ToString()

Returns

string

String representation.

TryToDbLiteral(object)

Attempts to create an inline DB literal representation of the provided value.

[Pure]
public abstract string? TryToDbLiteral(object value)

Parameters

value object

Value to convert.

Returns

string

DB literal from value or null when it is not of the specified RuntimeType.

TryToParameterValue(object)

Attempts to create an object from the provided value that can be used to set DB parameter's Value with.

[Pure]
public abstract object? TryToParameterValue(object value)

Parameters

value object

Value to convert.

Returns

object

Converted value or null when it is not of the specified RuntimeType.