Class ColumnDefinition
Represents the definition of a database column, including its data type, properties, and constraints.
Inheritance
Namespace: Umbraco.Cms.Infrastructure.Persistence.DatabaseModelDefinitions
Assembly: Umbraco.Infrastructure.dll
Syntax
public class ColumnDefinition
Constructors
View SourceColumnDefinition()
Declaration
public ColumnDefinition()
Properties
View SourceConstraintName
Gets or sets the name of the constraint associated with the column.
Declaration
public virtual string? ConstraintName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
CustomDbType
Used for column types that cannot be natively mapped.
Declaration
public SpecialDbType? CustomDbType { get; set; }
Property Value
| Type | Description |
|---|---|
| SpecialDbType? |
CustomType
Gets or sets a custom database type for the column, overriding the default type mapping if specified.
Declaration
public virtual string? CustomType { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
DefaultValue
Gets or sets the default value for the column.
Declaration
public virtual object? DefaultValue { get; set; }
Property Value
| Type | Description |
|---|---|
| object |
IsForeignKey
Gets or sets a value indicating whether this column is a foreign key.
Declaration
public virtual bool IsForeignKey { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsIdentity
Gets or sets a value indicating whether this column is an identity column.
Declaration
public virtual bool IsIdentity { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsIndexed
Gets or sets a value indicating whether the column is indexed.
Declaration
public virtual bool IsIndexed { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Clustered?
IsNullable
Gets or sets a value indicating whether the column allows null values.
Declaration
public virtual bool IsNullable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPrimaryKey
Gets or sets a value indicating whether this column is part of the primary key.
Declaration
public virtual bool IsPrimaryKey { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsUnique
Gets or sets a value indicating whether the column has a unique constraint.
Declaration
public virtual bool IsUnique { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
ModificationType
Gets or sets a value indicating the type of modification (such as addition, update, or deletion) applied to the column definition.
Declaration
public virtual ModificationType ModificationType { get; set; }
Property Value
| Type | Description |
|---|---|
| ModificationType |
Name
Gets or sets the name of the column.
Declaration
public virtual string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Precision
Gets or sets the precision of the column, which defines the total number of digits that can be stored for numeric data types.
Declaration
public virtual int Precision { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
PrimaryKeyColumns
Gets or sets the names of the columns that compose a composite primary key.
Declaration
public virtual string? PrimaryKeyColumns { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
When the primary key spans multiple columns
PrimaryKeyName
Gets or sets the name of the primary key associated with this column, if any.
Declaration
public virtual string? PrimaryKeyName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
PropertyType
Gets or sets the CLR Type that represents the property associated with this column.
This type is used to infer the database type when DbType is not explicitly set, typically during initial table creation.
Declaration
public Type PropertyType { get; set; }
Property Value
| Type | Description |
|---|---|
| Type |
Remarks
When DbType isn't set explicitly the Type will be used to find the right DbType in the SqlSyntaxProvider. This type is typically used as part of an initial table creation
Seeding
Gets or sets the initial seed value used for auto-incrementing the column, if applicable.
Declaration
public virtual int Seeding { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Size
Gets or sets the maximum size or length of the column, typically used for string or binary data types.
Declaration
public virtual int Size { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
TableName
Gets or sets the name of the table that this column belongs to.
Declaration
public virtual string? TableName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Type
Gets or sets the data type of the column in the database.
Declaration
public virtual DbType? Type { get; set; }
Property Value
| Type | Description |
|---|---|
| DbType? |
Remarks
This type is typically used as part of a migration