Table of Contents

Interface ITable

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

Represents a table in the database.

public interface ITable : ITableBase, IAnnotatable, IReadOnlyAnnotatable
Inherited Members

Remarks

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

Properties

CheckConstraints

Gets the check constraints for this table.

IEnumerable<ICheckConstraint> CheckConstraints { get; }

Property Value

IEnumerable<ICheckConstraint>

Columns

Gets the columns defined for this table.

IEnumerable<IColumn> Columns { get; }

Property Value

IEnumerable<IColumn>

Comment

Gets the comment for this table.

string? Comment { get; }

Property Value

string

EntityTypeMappings

Gets the entity type mappings.

IEnumerable<ITableMapping> EntityTypeMappings { get; }

Property Value

IEnumerable<ITableMapping>

ForeignKeyConstraints

Gets the foreign key constraints for this table.

IEnumerable<IForeignKeyConstraint> ForeignKeyConstraints { get; }

Property Value

IEnumerable<IForeignKeyConstraint>

Indexes

Gets the indexes for this table.

IEnumerable<ITableIndex> Indexes { get; }

Property Value

IEnumerable<ITableIndex>

IsExcludedFromMigrations

Gets the value indicating whether the table should be managed by migrations

bool IsExcludedFromMigrations { get; }

Property Value

bool

PrimaryKey

Gets the primary key for this table.

IPrimaryKeyConstraint? PrimaryKey { get; }

Property Value

IPrimaryKeyConstraint

ReferencingForeignKeyConstraints

Gets the foreign key constraints referencing this table.

IEnumerable<IForeignKeyConstraint> ReferencingForeignKeyConstraints { get; }

Property Value

IEnumerable<IForeignKeyConstraint>

Triggers

Gets the triggers for this table.

IEnumerable<ITrigger> Triggers { get; }

Property Value

IEnumerable<ITrigger>

UniqueConstraints

Gets the unique constraints including the primary key for this table.

IEnumerable<IUniqueConstraint> UniqueConstraints { get; }

Property Value

IEnumerable<IUniqueConstraint>

Methods

FindColumn(IProperty)

Gets the column mapped to the given property. Returns null if no column is mapped to the given property.

IColumn? FindColumn(IProperty property)

Parameters

property IProperty

Returns

IColumn

FindColumn(string)

Gets the column with a given name. Returns null if no column with the given name is defined.

IColumn? FindColumn(string name)

Parameters

name string

Returns

IColumn

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.