RelationshipDiscoveryConvention.TryGetTargetEntityTypeBuilder Method

Definition

Finds or tries to create an entity type target for the given navigation member.

protected virtual Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder? TryGetTargetEntityTypeBuilder (Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder entityTypeBuilder, Type targetClrType, System.Reflection.MemberInfo navigationMemberInfo, bool? shouldBeOwned = default, bool shouldCreate = true);
abstract member TryGetTargetEntityTypeBuilder : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder * Type * System.Reflection.MemberInfo * Nullable<bool> * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder
override this.TryGetTargetEntityTypeBuilder : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder * Type * System.Reflection.MemberInfo * Nullable<bool> * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder
Protected Overridable Function TryGetTargetEntityTypeBuilder (entityTypeBuilder As IConventionEntityTypeBuilder, targetClrType As Type, navigationMemberInfo As MemberInfo, Optional shouldBeOwned As Nullable(Of Boolean) = Nothing, Optional shouldCreate As Boolean = true) As IConventionEntityTypeBuilder

Parameters

entityTypeBuilder
IConventionEntityTypeBuilder

The builder for the referencing entity type.

targetClrType
Type

The CLR type of the target entity type.

navigationMemberInfo
MemberInfo

The navigation member.

shouldBeOwned
Nullable<Boolean>

Whether the target entity type should be owned.

shouldCreate
Boolean

Whether an entity type should be created if one doesn't currently exist.

Returns

The builder for the target entity type or null if it can't be created.

Applies to