DmColumnAttribute
Namespace: MJCZone.DapperMatic.DataAnnotations
Assembly: MJCZone.DapperMatic
Summary
Attribute to define a database column.
Inheritance
Base Class: Attribute
sealed public
Contents
Constructors (1) | Methods (6) | Properties (19)
Constructors
DmColumnAttribute
Initializes a new instance of the DmColumnAttribute class representing a column in a database table.
DmColumnAttribute(
string columnName,
string providerDataType,
int length,
int precision,
int scale,
string checkExpression,
string defaultExpression,
bool isNullable,
bool isPrimaryKey,
bool isAutoIncrement,
bool isUnique,
bool isUnicode,
bool isIndexed,
bool isForeignKey,
string referencedTableName,
string referencedColumnName,
DmForeignKeyAction onDelete,
DmForeignKeyAction onUpdate)Parameters
- columnName (string) - The name of the column.
- providerDataType (string) - The data type of the column as defined by the database provider. Can be null if not specified.
- length (int) - The maximum length (in characters) for string or binary data types. Can be null if not specified.
- precision (int) - The total number of digits for numeric data types. Can be null if not specified.
- scale (int) - The number of digits to the right of the decimal point for numeric data types. Can be null if not specified.
- checkExpression (string) - A check constraint expression for the column.
- defaultExpression (string) - A default value expression for the column.
- isNullable (bool) - Whether the column allows null values.
- isPrimaryKey (bool) - Whether the column is part of the primary key.
- isAutoIncrement (bool) - Whether the column is auto-incremented.
- isUnique (bool) - Whether the column is unique.
- isUnicode (bool) - Whether the column is Unicode.
- isIndexed (bool) - Whether the column is indexed.
- isForeignKey (bool) - Whether the column is a foreign key.
- referencedTableName (string) - The referenced table name if this column is a foreign key.
- referencedColumnName (string) - The referenced column name if this column is a foreign key.
- onDelete (DmForeignKeyAction) - The action to take when a referenced row is deleted.
- onUpdate (DmForeignKeyAction) - The action to take when a referenced row is updated.
Methods
| Method | Summary |
|---|---|
| Equals | |
| GetHashCode | |
| Match | |
| IsDefaultAttribute | |
| GetType | |
| ToString |
Equals
Equals()GetHashCode
GetHashCode()Match
Match()IsDefaultAttribute
IsDefaultAttribute()GetType
GetType()ToString
ToString()Properties
ColumnName
Gets the column name.
Type: string?
ProviderDataType
Gets the provider data type. Format of provider data types: {mysql:varchar(255),sqlserver:nvarchar(255)}.
Type: string?
Length
Gets the length of the column.
Type: int?
Precision
Gets the precision of the column.
Type: int?
Scale
Gets the scale of the column.
Type: int?
CheckExpression
Gets the check expression for the column.
Type: string?
DefaultExpression
Gets the default expression for the column.
Type: string?
IsNullable
Gets a value indicating whether the column is nullable.
Type: bool?
IsPrimaryKey
Gets a value indicating whether the column is a primary key.
Type: bool?
IsAutoIncrement
Gets a value indicating whether the column is auto-incremented.
Type: bool?
IsUnique
Gets 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?
IsIndexed
Gets a value indicating whether the column is indexed.
Type: bool?
IsForeignKey
Gets a value indicating whether the column is a foreign key.
Type: bool?
ReferencedTableName
Gets the referenced table name for the foreign key.
Type: string?
ReferencedColumnName
Gets the referenced column name for the foreign key.
Type: string?
OnDelete
Gets the action to perform on delete.
Type: DmForeignKeyAction?
OnUpdate
Gets the action to perform on update.
Type: DmForeignKeyAction?
TypeId
Type: object