Class ConstraintDefinition
Represents the definition of a database constraint, such as a primary key, foreign key, or unique constraint, used within the persistence layer.
Inheritance
Namespace: Umbraco.Cms.Infrastructure.Persistence.DatabaseModelDefinitions
Assembly: Umbraco.Infrastructure.dll
Syntax
public class ConstraintDefinition
Constructors
View SourceConstraintDefinition(ConstraintType)
Initializes a new instance of the ConstraintDefinition class using the specified constraint type.
Declaration
public ConstraintDefinition(ConstraintType type)
Parameters
| Type | Name | Description |
|---|---|---|
| ConstraintType | type | The constraint type. |
Fields
View SourceColumns
Declaration
public ICollection<string?> Columns
Field Value
| Type | Description |
|---|---|
| ICollection<string> |
Properties
View SourceConstraintName
Gets or sets the name of the database constraint associated with this definition.
Declaration
public string? ConstraintName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
IsNonUniqueConstraint
Gets a value indicating whether this constraint is non-unique.
Declaration
public bool IsNonUniqueConstraint { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPrimaryKeyClustered
Gets or sets a value indicating whether the primary key constraint is clustered on the table.
If true, the primary key is implemented as a clustered index; otherwise, it is non-clustered.
Declaration
public bool IsPrimaryKeyClustered { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPrimaryKeyConstraint
Gets a value indicating whether this constraint is a primary key constraint.
Declaration
public bool IsPrimaryKeyConstraint { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsUniqueConstraint
Gets a value indicating whether this constraint is a unique constraint.
Declaration
public bool IsUniqueConstraint { get; }
Property Value
| Type | Description |
|---|---|
| bool |
SchemaName
Gets or sets the schema name associated with the constraint.
Declaration
public string? SchemaName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
TableName
Gets or sets the name of the table associated with the constraint.
Declaration
public string? TableName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |