Table of Contents

Interface IRelationalModel

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

Represents a relational database.

public interface IRelationalModel : IAnnotatable, IReadOnlyAnnotatable

Remarks

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

Properties

Collation

Returns the database collation.

string? Collation { get; }

Property Value

string

Functions

Returns all user-defined functions contained in the model.

IEnumerable<IStoreFunction> Functions { get; }

Property Value

IEnumerable<IStoreFunction>

Model

Gets the full model.

IModel Model { get; }

Property Value

IModel

Queries

Returns all the SQL queries mapped in the model.

IEnumerable<ISqlQuery> Queries { get; }

Property Value

IEnumerable<ISqlQuery>

All the SQL queries mapped in the model.

Sequences

Returns all sequences contained in the model.

IEnumerable<ISequence> Sequences { get; }

Property Value

IEnumerable<ISequence>

StoredProcedures

Returns all stored procedures contained in the model.

IEnumerable<IStoreStoredProcedure> StoredProcedures { get; }

Property Value

IEnumerable<IStoreStoredProcedure>

Tables

Returns all the tables mapped in the model.

IEnumerable<ITable> Tables { get; }

Property Value

IEnumerable<ITable>

Views

Returns all the views mapped in the model.

IEnumerable<IView> Views { get; }

Property Value

IEnumerable<IView>

All the views mapped in the model.

Methods

FindFunction(string, string?, IReadOnlyList<string>)

Finds a IStoreFunction with the given signature.

IStoreFunction? FindFunction(string name, string? schema, IReadOnlyList<string> parameters)

Parameters

name string

The name of the function.

schema string

The schema of the function.

parameters IReadOnlyList<string>

A list of parameter types.

Returns

IStoreFunction

The IStoreFunction or null if no function with the given name was found.

FindQuery(string)

Gets the SQL query with the given name. Returns null if no SQL query with the given name is defined.

ISqlQuery? FindQuery(string name)

Parameters

name string

The name of the SQL query.

Returns

ISqlQuery

The SQL query with a given name or null if no SQL query with the given name is defined.

FindSequence(string, string?)

Finds an ISequence with the given name.

ISequence? FindSequence(string name, string? schema)

Parameters

name string

The sequence name.

schema string

The schema that contains the sequence.

Returns

ISequence

The ISequence or null if no sequence with the given name in the given schema was found.

FindStoredProcedure(string, string?)

Finds a IStoreStoredProcedure with the name.

IStoreStoredProcedure? FindStoredProcedure(string name, string? schema)

Parameters

name string

The name of the stored procedure.

schema string

The schema of the stored procedure.

Returns

IStoreStoredProcedure

The IStoreStoredProcedure or null if no stored procedure with the given name was found.

FindTable(string, string?)

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

ITable? FindTable(string name, string? schema)

Parameters

name string

The name of the table.

schema string

The schema of the table.

Returns

ITable

The table with a given name or null if no table with the given name is defined.

FindView(string, string?)

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

IView? FindView(string name, string? schema)

Parameters

name string

The name of the view.

schema string

The schema of the view.

Returns

IView

The view with a given name or null if no view with the given name is defined.

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.