IConventionEntityTypeBuilder.HasRelationship Method

Definition

Overloads

HasRelationship(IConventionEntityType, Boolean)

Configures a relationship between this and the target entity type.

HasRelationship(IConventionEntityType, IConventionKey, Boolean)

Configures a relationship between this and the target entity type with the target as the principal end.

HasRelationship(IConventionEntityType, IReadOnlyList<IConventionProperty>, Boolean)

Configures a relationship between this and the target entity type with the target as the principal end.

HasRelationship(IConventionEntityType, IReadOnlyList<IConventionProperty>, IConventionKey, Boolean)

Configures a relationship between this and the target entity type with the target as the principal end.

HasRelationship(IConventionEntityType, MemberInfo, Boolean, Boolean)

Configures a relationship between this and the target entity type.

HasRelationship(IConventionEntityType, String, Boolean, Boolean)

Configures a relationship between this and the target entity type.

HasRelationship(IConventionEntityType, MemberInfo, MemberInfo, Boolean, Boolean)

Configures a relationship between this and the target entity type.

HasRelationship(IConventionEntityType, String, String, Boolean, Boolean)

Configures a relationship between this and the target entity type.

HasRelationship(IConventionEntityType, Boolean)

Configures a relationship between this and the target entity type.

public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder? HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, bool fromDataAnnotation = false);
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder
Public Function HasRelationship (targetEntityType As IConventionEntityType, Optional fromDataAnnotation As Boolean = false) As IConventionRelationshipBuilder
Public Function HasRelationship (targetEntityType As IConventionEntityType, Optional fromDataAnnotation As Boolean = false) As IConventionForeignKeyBuilder

Parameters

targetEntityType
IConventionEntityType

The entity type that this relationship targets.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

An object that can be used to configure the relationship.

Applies to

HasRelationship(IConventionEntityType, IConventionKey, Boolean)

Configures a relationship between this and the target entity type with the target as the principal end.

public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType principalEntityType, Microsoft.EntityFrameworkCore.Metadata.IConventionKey principalKey, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType principalEntityType, Microsoft.EntityFrameworkCore.Metadata.IConventionKey principalKey, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder? HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType principalEntityType, Microsoft.EntityFrameworkCore.Metadata.IConventionKey principalKey, bool fromDataAnnotation = false);
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * Microsoft.EntityFrameworkCore.Metadata.IConventionKey * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * Microsoft.EntityFrameworkCore.Metadata.IConventionKey * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder
Public Function HasRelationship (principalEntityType As IConventionEntityType, principalKey As IConventionKey, Optional fromDataAnnotation As Boolean = false) As IConventionRelationshipBuilder
Public Function HasRelationship (principalEntityType As IConventionEntityType, principalKey As IConventionKey, Optional fromDataAnnotation As Boolean = false) As IConventionForeignKeyBuilder

Parameters

principalEntityType
IConventionEntityType

The entity type that this relationship targets.

principalKey
IConventionKey

The referenced key.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

An object that can be used to configure the relationship if it exists on the entity type, null otherwise.

Applies to

HasRelationship(IConventionEntityType, IReadOnlyList<IConventionProperty>, Boolean)

Configures a relationship between this and the target entity type with the target as the principal end.

public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType principalEntityType, System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> dependentProperties, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType principalEntityType, System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> dependentProperties, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder? HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType principalEntityType, System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> dependentProperties, bool fromDataAnnotation = false);
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder
Public Function HasRelationship (principalEntityType As IConventionEntityType, dependentProperties As IReadOnlyList(Of IConventionProperty), Optional fromDataAnnotation As Boolean = false) As IConventionRelationshipBuilder
Public Function HasRelationship (principalEntityType As IConventionEntityType, dependentProperties As IReadOnlyList(Of IConventionProperty), Optional fromDataAnnotation As Boolean = false) As IConventionForeignKeyBuilder

Parameters

principalEntityType
IConventionEntityType

The entity type that this relationship targets.

dependentProperties
IReadOnlyList<IConventionProperty>

The properties on this type that make up the foreign key.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

An object that can be used to configure the relationship if it exists on the entity type, null otherwise.

Applies to

HasRelationship(IConventionEntityType, IReadOnlyList<IConventionProperty>, IConventionKey, Boolean)

Configures a relationship between this and the target entity type with the target as the principal end.

public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType principalEntityType, System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> dependentProperties, Microsoft.EntityFrameworkCore.Metadata.IConventionKey principalKey, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType principalEntityType, System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> dependentProperties, Microsoft.EntityFrameworkCore.Metadata.IConventionKey principalKey, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder? HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType principalEntityType, System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> dependentProperties, Microsoft.EntityFrameworkCore.Metadata.IConventionKey principalKey, bool fromDataAnnotation = false);
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> * Microsoft.EntityFrameworkCore.Metadata.IConventionKey * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> * Microsoft.EntityFrameworkCore.Metadata.IConventionKey * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder
Public Function HasRelationship (principalEntityType As IConventionEntityType, dependentProperties As IReadOnlyList(Of IConventionProperty), principalKey As IConventionKey, Optional fromDataAnnotation As Boolean = false) As IConventionRelationshipBuilder
Public Function HasRelationship (principalEntityType As IConventionEntityType, dependentProperties As IReadOnlyList(Of IConventionProperty), principalKey As IConventionKey, Optional fromDataAnnotation As Boolean = false) As IConventionForeignKeyBuilder

Parameters

principalEntityType
IConventionEntityType

The entity type that this relationship targets.

dependentProperties
IReadOnlyList<IConventionProperty>

The properties on this type that make up the foreign key

principalKey
IConventionKey

The referenced key.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

An object that can be used to configure the relationship if it exists on the entity type, null otherwise.

Applies to

HasRelationship(IConventionEntityType, MemberInfo, Boolean, Boolean)

Configures a relationship between this and the target entity type.

public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, System.Reflection.MemberInfo navigationToTarget, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, System.Reflection.MemberInfo navigation, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder? HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, System.Reflection.MemberInfo navigation, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false);
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * System.Reflection.MemberInfo * bool * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * System.Reflection.MemberInfo * bool * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder
Public Function HasRelationship (targetEntityType As IConventionEntityType, navigationToTarget As MemberInfo, Optional setTargetAsPrincipal As Boolean = false, Optional fromDataAnnotation As Boolean = false) As IConventionRelationshipBuilder
Public Function HasRelationship (targetEntityType As IConventionEntityType, navigation As MemberInfo, Optional setTargetAsPrincipal As Boolean = false, Optional fromDataAnnotation As Boolean = false) As IConventionForeignKeyBuilder

Parameters

targetEntityType
IConventionEntityType

The entity type that this relationship targets.

navigationToTargetnavigation
MemberInfo

The navigation property on this entity type that is part of the relationship.

setTargetAsPrincipal
Boolean

A value indicating whether the target entity type should be configured as the principal end.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

An object that can be used to configure the relationship if it exists on the entity type, null otherwise.

Applies to

HasRelationship(IConventionEntityType, String, Boolean, Boolean)

Configures a relationship between this and the target entity type.

public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, string navigationToTargetName, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, string navigationName, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder? HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, string navigationName, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false);
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * string * bool * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * string * bool * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder
Public Function HasRelationship (targetEntityType As IConventionEntityType, navigationToTargetName As String, Optional setTargetAsPrincipal As Boolean = false, Optional fromDataAnnotation As Boolean = false) As IConventionRelationshipBuilder
Public Function HasRelationship (targetEntityType As IConventionEntityType, navigationName As String, Optional setTargetAsPrincipal As Boolean = false, Optional fromDataAnnotation As Boolean = false) As IConventionForeignKeyBuilder

Parameters

targetEntityType
IConventionEntityType

The entity type that this relationship targets.

navigationToTargetNamenavigationName
String

The name of the navigation property on this entity type that is part of the relationship.

setTargetAsPrincipal
Boolean

A value indicating whether the target entity type should be configured as the principal end.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

An object that can be used to configure the relationship if it exists on the entity type, null otherwise.

Applies to

HasRelationship(IConventionEntityType, MemberInfo, MemberInfo, Boolean, Boolean)

Configures a relationship between this and the target entity type.

public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, System.Reflection.MemberInfo navigationToTarget, System.Reflection.MemberInfo inverseNavigation, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, System.Reflection.MemberInfo navigation, System.Reflection.MemberInfo inverseNavigation, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder? HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, System.Reflection.MemberInfo navigation, System.Reflection.MemberInfo? inverseNavigation, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false);
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * System.Reflection.MemberInfo * System.Reflection.MemberInfo * bool * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * System.Reflection.MemberInfo * System.Reflection.MemberInfo * bool * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder
Public Function HasRelationship (targetEntityType As IConventionEntityType, navigationToTarget As MemberInfo, inverseNavigation As MemberInfo, Optional setTargetAsPrincipal As Boolean = false, Optional fromDataAnnotation As Boolean = false) As IConventionRelationshipBuilder
Public Function HasRelationship (targetEntityType As IConventionEntityType, navigation As MemberInfo, inverseNavigation As MemberInfo, Optional setTargetAsPrincipal As Boolean = false, Optional fromDataAnnotation As Boolean = false) As IConventionForeignKeyBuilder

Parameters

targetEntityType
IConventionEntityType

The entity type that this relationship targets.

navigationToTargetnavigation
MemberInfo

The navigation property on this entity type that is part of the relationship.

inverseNavigation
MemberInfo

The navigation property on the target entity type that is part of the relationship. If null is specified, the relationship will be configured without a navigation property on the target end.

setTargetAsPrincipal
Boolean

A value indicating whether the target entity type should be configured as the principal end.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

An object that can be used to configure the relationship if it exists on the entity type, null otherwise.

Applies to

HasRelationship(IConventionEntityType, String, String, Boolean, Boolean)

Configures a relationship between this and the target entity type.

public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, string navigationToTargetName, string inverseNavigationName, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, string navigationName, string inverseNavigationName, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder? HasRelationship (Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType targetEntityType, string navigationName, string? inverseNavigationName, bool setTargetAsPrincipal = false, bool fromDataAnnotation = false);
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * string * string * bool * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder
abstract member HasRelationship : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * string * string * bool * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder
Public Function HasRelationship (targetEntityType As IConventionEntityType, navigationToTargetName As String, inverseNavigationName As String, Optional setTargetAsPrincipal As Boolean = false, Optional fromDataAnnotation As Boolean = false) As IConventionRelationshipBuilder
Public Function HasRelationship (targetEntityType As IConventionEntityType, navigationName As String, inverseNavigationName As String, Optional setTargetAsPrincipal As Boolean = false, Optional fromDataAnnotation As Boolean = false) As IConventionForeignKeyBuilder

Parameters

targetEntityType
IConventionEntityType

The entity type that this relationship targets.

navigationToTargetNamenavigationName
String

The name of the navigation property on this entity type that is part of the relationship.

inverseNavigationName
String

The name of the navigation property on the target entity type that is part of the relationship. If null is specified, the relationship will be configured without a navigation property on the target end.

setTargetAsPrincipal
Boolean

A value indicating whether the target entity type should be configured as the principal end.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

An object that can be used to configure the relationship if it exists on the entity type, null otherwise.

Applies to