IMutableForeignKey IMutableForeignKey Interface

Represents a relationship where a foreign key property(s) in a dependent entity type reference a corresponding primary or alternate key in a principal entity type.

This interface is used during model creation and allows the metadata to be modified. Once the model is built, IForeignKey represents a ready-only view of the same metadata.

Syntax

Declaration

public interface IMutableForeignKey : IForeignKey, IMutableAnnotatable, IAnnotatablePublic Interface IMutableForeignKey
    Inherits IForeignKey, IMutableAnnotatable

Inherited Members

Item[String],
Item(String),
GetAnnotations(),
GetAnnotations(),
AddAnnotation(String, Object),
AddAnnotation(String, Object),
FindAnnotation(String),
FindAnnotation(String),
RemoveAnnotation(String)
RemoveAnnotation(String)

Properties summary

Gets the dependent entity type. This may be different from the type that Properties are defined on when the relationship is defined a derived type in an inheritance hierarchy (since the properties may be defined on a base type).

Gets or sets a value indicating how a delete operation is applied to dependent entities in the relationship when the principal is deleted or the relationship is severed.

Gets the navigation property on the dependent entity type that points to the principal entity.

Gets or sets a value indicating if this relationship is required. If true, the dependent entity must always be assigned to a valid principal entity.

Gets or sets a value indicating whether the values assigned to the foreign key properties are unique.

Gets the principal entity type that this relationship targets. This may be different from the type that

PrincipalKey is defined on when the relationship targets a derived type in an inheritance hierarchy (since the key is defined on the base type of the hierarchy).

Gets the primary or alternate key that the relationship targets.

Gets the navigation property on the principal entity type that points to the dependent entity.

Gets the foreign key properties in the dependent entity.

Methods summary

Sets the navigation property on the dependent entity type that points to the principal entity.

Sets the navigation property on the dependent entity type that points to the principal entity.

Sets the navigation property on the principal entity type that points to the dependent entity.

Sets the navigation property on the principal entity type that points to the dependent entity.

Properties

  • DeclaringEntityType
    DeclaringEntityType

    Gets the dependent entity type. This may be different from the type that Properties are defined on when the relationship is defined a derived type in an inheritance hierarchy (since the properties may be defined on a base type).

    IMutableEntityType DeclaringEntityType { get; }ReadOnly Property DeclaringEntityType As IMutableEntityType

    Property Value

  • DeleteBehavior
    DeleteBehavior

    Gets or sets a value indicating how a delete operation is applied to dependent entities in the relationship when the principal is deleted or the relationship is severed.

    DeleteBehavior DeleteBehavior { get; set; }Property DeleteBehavior As DeleteBehavior

    Property Value

  • DependentToPrincipal
    DependentToPrincipal

    Gets the navigation property on the dependent entity type that points to the principal entity.

    IMutableNavigation DependentToPrincipal { get; }ReadOnly Property DependentToPrincipal As IMutableNavigation

    Property Value

  • IsRequired
    IsRequired

    Gets or sets a value indicating if this relationship is required. If true, the dependent entity must always be assigned to a valid principal entity.

    bool IsRequired { get; set; }Property IsRequired As Boolean

    Property Value

    • System.Boolean
      System.Boolean
  • IsUnique
    IsUnique

    Gets or sets a value indicating whether the values assigned to the foreign key properties are unique.

    bool IsUnique { get; set; }Property IsUnique As Boolean

    Property Value

    • System.Boolean
      System.Boolean
  • PrincipalEntityType
    PrincipalEntityType

    Gets the principal entity type that this relationship targets. This may be different from the type that

    PrincipalKey is defined on when the relationship targets a derived type in an inheritance hierarchy (since the key is defined on the base type of the hierarchy).

    IMutableEntityType PrincipalEntityType { get; }ReadOnly Property PrincipalEntityType As IMutableEntityType

    Property Value

  • PrincipalKey
    PrincipalKey

    Gets the primary or alternate key that the relationship targets.

    IMutableKey PrincipalKey { get; }ReadOnly Property PrincipalKey As IMutableKey

    Property Value

  • PrincipalToDependent
    PrincipalToDependent

    Gets the navigation property on the principal entity type that points to the dependent entity.

    IMutableNavigation PrincipalToDependent { get; }ReadOnly Property PrincipalToDependent As IMutableNavigation

    Property Value

  • Properties
    Properties

    Gets the foreign key properties in the dependent entity.

    IReadOnlyList<IMutableProperty> Properties { get; }ReadOnly Property Properties As IReadOnlyList(Of IMutableProperty)

    Property Value

Methods

  • HasDependentToPrincipal(PropertyInfo)
    HasDependentToPrincipal(PropertyInfo)

    Sets the navigation property on the dependent entity type that points to the principal entity.

    IMutableNavigation HasDependentToPrincipal(PropertyInfo property)Function HasDependentToPrincipal(property As PropertyInfo) As IMutableNavigation

    Parameters

    • property
      System.Reflection.PropertyInfo
      System.Reflection.PropertyInfo

      The navigation property on the dependent type. Passing null will result in there being no navigation property defined.

    Returns

  • HasDependentToPrincipal(String)
    HasDependentToPrincipal(String)

    Sets the navigation property on the dependent entity type that points to the principal entity.

    IMutableNavigation HasDependentToPrincipal(string name)Function HasDependentToPrincipal(name As String) As IMutableNavigation

    Parameters

    • name
      System.String
      System.String

      The name of the navigation property on the dependent type. Passing null will result in there being no navigation property defined.

    Returns

  • HasPrincipalToDependent(PropertyInfo)
    HasPrincipalToDependent(PropertyInfo)

    Sets the navigation property on the principal entity type that points to the dependent entity.

    IMutableNavigation HasPrincipalToDependent(PropertyInfo property)Function HasPrincipalToDependent(property As PropertyInfo) As IMutableNavigation

    Parameters

    • property
      System.Reflection.PropertyInfo
      System.Reflection.PropertyInfo

      The name of the navigation property on the principal type. Passing null will result in there being no navigation property defined.

    Returns

  • HasPrincipalToDependent(String)
    HasPrincipalToDependent(String)

    Sets the navigation property on the principal entity type that points to the dependent entity.

    IMutableNavigation HasPrincipalToDependent(string name)Function HasPrincipalToDependent(name As String) As IMutableNavigation

    Parameters

    • name
      System.String
      System.String

      The name of the navigation property on the principal type. Passing null will result in there being no navigation property defined.

    Returns

Details

Assembly

Microsoft.EntityFrameworkCore.dll