Table of Contents

Interface IUniqueConstraint

Namespace
Microsoft.EntityFrameworkCore.Metadata
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

Represents a unique constraint.

public interface IUniqueConstraint : IAnnotatable, IReadOnlyAnnotatable

Remarks

See Modeling entity types and relationships for more information and examples.

Properties

Columns

Gets the columns that are participating in the unique constraint.

IReadOnlyList<IColumn> Columns { get; }

Property Value

IReadOnlyList<IColumn>

MappedKeys

Gets the mapped keys.

IEnumerable<IKey> MappedKeys { get; }

Property Value

IEnumerable<IKey>

Name

Gets the name of the unique constraint.

string Name { get; }

Property Value

string

Table

Gets the table on with the unique constraint is declared.

ITable Table { get; }

Property Value

ITable

Methods

GetIsPrimaryKey()

Gets a value indicating whether this constraint is the primary key.

bool GetIsPrimaryKey()

Returns

bool

true if the constraint is the primary key

ToDebugString(MetadataDebugStringOptions, int)

Creates a human-readable representation of the given metadata.

Warning: Do not rely on the format of the returned string. It is designed for debugging only and may change arbitrarily between releases.

string ToDebugString(MetadataDebugStringOptions options = 0, int indent = 0)

Parameters

options MetadataDebugStringOptions

Options for generating the string.

indent int

The number of indent spaces to use before each new line.

Returns

string

A human-readable representation.