Skip to content

DmColumn

Namespace: MJCZone.DapperMatic.Models

Assembly: MJCZone.DapperMatic

Summary

Represents a database column with various properties and methods to determine its characteristics.

public

Contents

Constructors (3) | Methods (19) | Properties (24)

Constructors

DmColumn

Initializes a new instance of the DmColumn class.

csharp
DmColumn()

DmColumn

Initializes a new instance of the DmColumn class. Used for quick creation when schema and table names are not needed, as when creating a table.

csharp
DmColumn(
    string columnName,
    Type dotnetType,
    DbProviderType providerDataTypes,
    String} length,
    Int32} precision,
    Int32} scale,
    Int32} isNullable,
    bool isPrimaryKey,
    bool isAutoIncrement,
    bool isUnique,
    bool isUnicode,
    bool isIndexed,
    bool isForeignKey,
    bool referencedTableName,
    string referencedColumnName,
    string onDelete,
    DmForeignKeyAction} onUpdate,
    DmForeignKeyAction} defaultExpression,
    string defaultExpressionFunc,
    DbProviderType checkExpression,
    String} checkExpressionFunc)

Parameters

  • columnName (string) - The column name.
  • dotnetType (Type) - The .NET type of the column.
  • providerDataTypes (DbProviderType) - The provider data types.
  • length (String}) - The length of the column.
  • precision (Int32}) - The precision of the column.
  • scale (Int32}) - The scale of the column.
  • isNullable (Int32}) - Indicates whether the column is nullable.
  • isPrimaryKey (bool) - Indicates whether the column is a primary key.
  • isAutoIncrement (bool) - Indicates whether the column is auto-incremented.
  • isUnique (bool) - Indicates whether the column is unique.
  • isUnicode (bool) - Indicates whether the column explicitly supports unicode characters.
  • isIndexed (bool) - Indicates whether the column is indexed.
  • isForeignKey (bool) - Indicates whether the column is a foreign key.
  • referencedTableName (bool) - The referenced table name.
  • referencedColumnName (string) - The referenced column name.
  • onDelete (string) - The action on delete.
  • onUpdate (DmForeignKeyAction}) - The action on update.
  • defaultExpression (DmForeignKeyAction}) - The default expression.
  • defaultExpressionFunc (string) - The default expression function for provider-specific defaults.
  • checkExpression (DbProviderType) - The check expression.
  • checkExpressionFunc (String}) - The check expression function for provider-specific checks.

DmColumn

Initializes a new instance of the DmColumn class with the specified parameters.

csharp
DmColumn(
    string schemaName,
    string tableName,
    string columnName,
    Type dotnetType,
    DbProviderType providerDataTypes,
    String} length,
    Int32} precision,
    Int32} scale,
    Int32} isNullable,
    bool isPrimaryKey,
    bool isAutoIncrement,
    bool isUnique,
    bool isUnicode,
    bool isIndexed,
    bool isForeignKey,
    bool referencedTableName,
    string referencedColumnName,
    string onDelete,
    DmForeignKeyAction} onUpdate,
    DmForeignKeyAction} defaultExpression,
    string defaultExpressionFunc,
    DbProviderType checkExpression,
    String} checkExpressionFunc)

Parameters

  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • dotnetType (Type) - The .NET type of the column.
  • providerDataTypes (DbProviderType) - The provider data types.
  • length (String}) - The length of the column.
  • precision (Int32}) - The precision of the column.
  • scale (Int32}) - The scale of the column.
  • isNullable (Int32}) - Indicates whether the column is nullable.
  • isPrimaryKey (bool) - Indicates whether the column is a primary key.
  • isAutoIncrement (bool) - Indicates whether the column is auto-incremented.
  • isUnique (bool) - Indicates whether the column is unique.
  • isUnicode (bool) - Indicates whether the column explicitly supports unicode characters.
  • isIndexed (bool) - Indicates whether the column is indexed.
  • isForeignKey (bool) - Indicates whether the column is a foreign key.
  • referencedTableName (bool) - The referenced table name.
  • referencedColumnName (string) - The referenced column name.
  • onDelete (string) - The action on delete.
  • onUpdate (DmForeignKeyAction}) - The action on update.
  • defaultExpression (DmForeignKeyAction}) - The default expression.
  • defaultExpressionFunc (string) - The default expression function for provider-specific defaults.
  • checkExpression (DbProviderType) - The check expression.
  • checkExpressionFunc (String}) - The check expression function for provider-specific checks.

Methods

MethodSummary
IsNumericDetermines whether the column is numeric.
IsTextDetermines whether the column is text.
IsDateTimeDetermines whether the column is a date/time type.
IsBooleanDetermines whether the column is a boolean type.
IsBinaryDetermines whether the column is a binary type.
IsGuidDetermines whether the column is a GUID type.
IsEnumDetermines whether the column is an enum type.
IsArrayDetermines whether the column is an array type.
IsDictionaryDetermines whether the column is a dictionary type.
IsEnumerableDetermines whether the column is an enumerable type.
GetTypeCategoryGets the type category of the column.
ToStringReturns a string representation of the column definition.
GetProviderDataTypeGets the provider data type for the specified provider.
SetProviderDataTypeSets the provider data type for the specified provider.
GetDefaultExpressionGets the effective default expression for the specified provider type. Returns the result of Default...
GetCheckExpressionGets the effective check expression for the specified provider type. Returns the result of CheckExpr...
GetType
Equals
GetHashCode

IsNumeric

Determines whether the column is numeric.

csharp
bool? IsNumeric()

Returns

Type: bool?

if the column is numeric; otherwise, .

IsText

Determines whether the column is text.

csharp
bool? IsText()

Returns

Type: bool?

if the column is text; otherwise, .

IsDateTime

Determines whether the column is a date/time type.

csharp
bool? IsDateTime()

Returns

Type: bool?

if the column is a date/time type; otherwise, .

IsBoolean

Determines whether the column is a boolean type.

csharp
bool? IsBoolean()

Returns

Type: bool?

if the column is a boolean type; otherwise, .

IsBinary

Determines whether the column is a binary type.

csharp
bool? IsBinary()

Returns

Type: bool?

if the column is a binary type; otherwise, .

IsGuid

Determines whether the column is a GUID type.

csharp
bool? IsGuid()

Returns

Type: bool?

if the column is a GUID type; otherwise, .

IsEnum

Determines whether the column is an enum type.

csharp
bool? IsEnum()

Returns

Type: bool?

if the column is an enum type; otherwise, .

IsArray

Determines whether the column is an array type.

csharp
bool? IsArray()

Returns

Type: bool?

if the column is an array type; otherwise, .

IsDictionary

Determines whether the column is a dictionary type.

csharp
bool? IsDictionary()

Returns

Type: bool?

if the column is a dictionary type; otherwise, .

IsEnumerable

Determines whether the column is an enumerable type.

csharp
bool? IsEnumerable()

Returns

Type: bool?

if the column is an enumerable type; otherwise, .

GetTypeCategory

Gets the type category of the column.

csharp
string GetTypeCategory()

Returns

Type: string

The type category of the column.

ToString

Returns a string representation of the column definition.

csharp
string ToString()

Returns

Type: string

A string representation of the column definition.

GetProviderDataType

Gets the provider data type for the specified provider.

csharp
string? GetProviderDataType(DbProviderType providerType)

Parameters

Returns

Type: string?

The provider data type for the specified provider.

SetProviderDataType

Sets the provider data type for the specified provider.

csharp
DmColumn SetProviderDataType(
    DbProviderType providerType,
    string providerDataType)

Parameters

  • providerType (DbProviderType) - The provider type.
  • providerDataType (string) - The provider data type.

Returns

Type: DmColumn

The current instance.

GetDefaultExpression

Gets the effective default expression for the specified provider type. Returns the result of DefaultExpressionFunc if set, otherwise returns DefaultExpression.

csharp
string? GetDefaultExpression(DbProviderType providerType)

Parameters

Returns

Type: string?

The default expression for the specified provider, or null if neither is set.

GetCheckExpression

Gets the effective check expression for the specified provider type. Returns the result of CheckExpressionFunc if set, otherwise returns CheckExpression.

csharp
string? GetCheckExpression(DbProviderType providerType)

Parameters

Returns

Type: string?

The check expression for the specified provider, or null if neither is set.

GetType

csharp
GetType()

Equals

csharp
Equals()

GetHashCode

csharp
GetHashCode()

Properties

SchemaName

Gets or sets the schema name.

Type: string?

TableName

Gets or sets the table name.

Type: string

ColumnName

Gets or sets the column name.

Type: string

DotnetType

Gets or sets the .NET type of the column.

Type: Type?

ProviderDataTypes

Gets the provider data types. The FULL native provider data type. This is the data type that the provider uses to store the data (e.g. "INTEGER", "DECIMAL(14,3)", "VARCHAR(255)", "TEXT", "BLOB", etc.)

Type: Dictionary<DbProviderType, string>

Length

Gets or sets the length of the column.

Type: int?

Precision

Gets or sets the precision of the column.

Type: int?

Scale

Gets or sets the scale of the column.

Type: int?

CheckExpression

Gets or sets the check expression. Setting this property will clear the CheckExpressionFunc property.

Type: string?

CheckExpressionFunc

Gets or sets the check expression function that generates provider-specific check expressions. Setting this property will clear the CheckExpression property.

Type: Func<DbProviderType, string>

DefaultExpression

Gets or sets the default expression.

Type: string?

DefaultExpressionFunc

Gets or sets the default expression function that generates provider-specific default values. Setting this property will clear the DefaultExpression property.

Type: Func<DbProviderType, string>

IsNullable

Gets or sets a value indicating whether the column is nullable.

Type: bool?

IsPrimaryKey

Gets or sets a value indicating whether the column is a primary key.

Type: bool?

IsAutoIncrement

Gets or sets a value indicating whether the column is auto-incremented.

Type: bool?

IsUnique

Gets or sets a value indicating whether the column is unique.

Type: bool?

IsUnicode

Gets or sets a value indicating whether the column explicitly supports unicode characters.

Type: bool?

IsFixedLength

Gets or sets a value indicating whether the column is of a fixed length.

Type: bool?

IsIndexed

Gets or sets a value indicating whether the column is indexed.

Type: bool?

IsForeignKey

Gets or sets a value indicating whether the column is a foreign key.

Type: bool?

ReferencedTableName

Gets or sets the referenced table name.

Type: string?

ReferencedColumnName

Gets or sets the referenced column name.

Type: string?

OnDelete

Gets or sets the action on delete.

Type: DmForeignKeyAction?

OnUpdate

Gets or sets the action on update.

Type: DmForeignKeyAction?