Table of Contents

Interface IForeignKeyConstraint

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

Represents a foreign key constraint.

public interface IForeignKeyConstraint : IAnnotatable, IReadOnlyAnnotatable

Remarks

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

Properties

Columns

Gets the columns that are participating in the foreign key constraint.

IReadOnlyList<IColumn> Columns { get; }

Property Value

IReadOnlyList<IColumn>

MappedForeignKeys

Gets the mapped foreign keys.

IEnumerable<IForeignKey> MappedForeignKeys { get; }

Property Value

IEnumerable<IForeignKey>

Name

Gets the name of the foreign key constraint.

string Name { get; }

Property Value

string

OnDeleteAction

Gets the action to be performed when the referenced row is deleted.

ReferentialAction OnDeleteAction { get; }

Property Value

ReferentialAction

PrincipalColumns

Gets the columns that are referenced by the foreign key constraint.

IReadOnlyList<IColumn> PrincipalColumns { get; }

Property Value

IReadOnlyList<IColumn>

PrincipalTable

Gets the table that is referenced by the foreign key constraint.

ITable PrincipalTable { get; }

Property Value

ITable

PrincipalUniqueConstraint

Gets the unique constraint on the columns referenced by the foreign key constraint.

IUniqueConstraint PrincipalUniqueConstraint { get; }

Property Value

IUniqueConstraint

Table

Gets the table on with the foreign key constraint is declared.

ITable Table { get; }

Property Value

ITable

Methods

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.