Table of Contents

Interface ISqlColumnTypeDefinition

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

Represents a type-erased definition of a column type.

public interface ISqlColumnTypeDefinition
Extension Methods

Properties

DataType

Underlying DB data type.

ISqlDataType DataType { get; }

Property Value

ISqlDataType

DefaultValue

Specifies the default value for this type.

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.

LambdaExpression OutputMapping { get; }

Property Value

LambdaExpression

RuntimeType

Underlying .NET type.

Type RuntimeType { get; }

Property Value

Type

Methods

SetParameterInfo(IDbDataParameter, bool)

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

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.

TryToDbLiteral(object)

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

[Pure]
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]
object? TryToParameterValue(object value)

Parameters

value object

Value to convert.

Returns

object

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