IMutableForeignKey IMutableForeignKey Interface

Definition

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.

public interface IMutableForeignKey : IForeignKey, IMutableAnnotatable, IAnnotatable
Public Interface IMutableForeignKey
    Inherits IForeignKey, IMutableAnnotatable

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

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

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

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
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
Value
System.Boolean System.Boolean

Item[String] Item(String)

Gets or sets the value of the annotation with the given name.

(Inherited from IMutableAnnotatable)

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

PrincipalKey PrincipalKey

Gets the primary or alternate key that the relationship targets.

IMutableKey PrincipalKey { get; }
ReadOnly Property PrincipalKey As IMutableKey

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

Properties Properties

Gets the foreign key properties in the dependent entity.

IReadOnlyList<IMutableProperty> Properties { get; }
ReadOnly Property Properties As IReadOnlyList(Of IMutableProperty)
Value
System.Collections.Generic.IReadOnlyList<IMutableProperty> System.Collections.Generic.IReadOnlyList(Of IMutableProperty)

Methods

AddAnnotation(String, Object) AddAnnotation(String, Object)

Adds an annotation to this object. Throws if an annotation with the specified name already exists.

(Inherited from IMutableAnnotatable)

FindAnnotation(String) FindAnnotation(String)

Gets the annotation with the given name, returning null if it does not exist.

(Inherited from IMutableAnnotatable)

GetAnnotations() GetAnnotations()

Gets all annotations on the current object.

(Inherited from IMutableAnnotatable)

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

The newly created navigation property.

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

The newly created navigation property.

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

The newly created navigation property.

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

The newly created navigation property.

RemoveAnnotation(String) RemoveAnnotation(String)

Removes the given annotation from this object.

(Inherited from IMutableAnnotatable)