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.
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.
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.
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
| Method | Summary |
|---|---|
| IsNumeric | Determines whether the column is numeric. |
| IsText | Determines whether the column is text. |
| IsDateTime | Determines whether the column is a date/time type. |
| IsBoolean | Determines whether the column is a boolean type. |
| IsBinary | Determines whether the column is a binary type. |
| IsGuid | Determines whether the column is a GUID type. |
| IsEnum | Determines whether the column is an enum type. |
| IsArray | Determines whether the column is an array type. |
| IsDictionary | Determines whether the column is a dictionary type. |
| IsEnumerable | Determines whether the column is an enumerable type. |
| GetTypeCategory | Gets the type category of the column. |
| ToString | Returns a string representation of the column definition. |
| GetProviderDataType | Gets the provider data type for the specified provider. |
| SetProviderDataType | Sets the provider data type for the specified provider. |
| GetDefaultExpression | Gets the effective default expression for the specified provider type. Returns the result of Default... |
| GetCheckExpression | Gets the effective check expression for the specified provider type. Returns the result of CheckExpr... |
| GetType | |
| Equals | |
| GetHashCode |
IsNumeric
Determines whether the column is numeric.
bool? IsNumeric()Returns
Type: bool?
IsText
Determines whether the column is text.
bool? IsText()Returns
Type: bool?
IsDateTime
Determines whether the column is a date/time type.
bool? IsDateTime()Returns
Type: bool?
IsBoolean
Determines whether the column is a boolean type.
bool? IsBoolean()Returns
Type: bool?
IsBinary
Determines whether the column is a binary type.
bool? IsBinary()Returns
Type: bool?
IsGuid
Determines whether the column is a GUID type.
bool? IsGuid()Returns
Type: bool?
IsEnum
Determines whether the column is an enum type.
bool? IsEnum()Returns
Type: bool?
IsArray
Determines whether the column is an array type.
bool? IsArray()Returns
Type: bool?
IsDictionary
Determines whether the column is a dictionary type.
bool? IsDictionary()Returns
Type: bool?
IsEnumerable
Determines whether the column is an enumerable type.
bool? IsEnumerable()Returns
Type: bool?
GetTypeCategory
Gets the type category of the column.
string GetTypeCategory()Returns
Type: string
The type category of the column.
ToString
Returns a string representation of the column definition.
string ToString()Returns
Type: string
A string representation of the column definition.
GetProviderDataType
Gets the provider data type for the specified provider.
string? GetProviderDataType(DbProviderType providerType)Parameters
- providerType (DbProviderType) - The provider type.
Returns
Type: string?
The provider data type for the specified provider.
SetProviderDataType
Sets the provider data type for the specified provider.
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.
string? GetDefaultExpression(DbProviderType providerType)Parameters
- providerType (DbProviderType) - The database provider type.
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.
string? GetCheckExpression(DbProviderType providerType)Parameters
- providerType (DbProviderType) - The database provider type.
Returns
Type: string?
The check expression for the specified provider, or null if neither is set.
GetType
GetType()Equals
Equals()GetHashCode
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?