共用方式為


EntityTypeExtensions.GetClosestCommonParent(IEntityType, IEntityType) 方法

定義

警告

Use IReadOnlyEntityType.FindClosestCommonParent

傳回最接近的實體類型,這是兩個指定實體類型的父代。 如果其中一個指定的實體是另一個實體的父系,則會傳回該父代。 null如果兩個實體類型不在相同的階層中,則傳回 。

public static Microsoft.EntityFrameworkCore.Metadata.IEntityType GetClosestCommonParent (this Microsoft.EntityFrameworkCore.Metadata.IEntityType entityType1, Microsoft.EntityFrameworkCore.Metadata.IEntityType entityType2);
[System.Obsolete("Use IReadOnlyEntityType.FindClosestCommonParent")]
public static Microsoft.EntityFrameworkCore.Metadata.IEntityType? GetClosestCommonParent (this Microsoft.EntityFrameworkCore.Metadata.IEntityType entityType1, Microsoft.EntityFrameworkCore.Metadata.IEntityType entityType2);
static member GetClosestCommonParent : Microsoft.EntityFrameworkCore.Metadata.IEntityType * Microsoft.EntityFrameworkCore.Metadata.IEntityType -> Microsoft.EntityFrameworkCore.Metadata.IEntityType
[<System.Obsolete("Use IReadOnlyEntityType.FindClosestCommonParent")>]
static member GetClosestCommonParent : Microsoft.EntityFrameworkCore.Metadata.IEntityType * Microsoft.EntityFrameworkCore.Metadata.IEntityType -> Microsoft.EntityFrameworkCore.Metadata.IEntityType
<Extension()>
Public Function GetClosestCommonParent (entityType1 As IEntityType, entityType2 As IEntityType) As IEntityType

參數

entityType1
IEntityType

任何實體類型。

entityType2
IEntityType

另一個實體類型。

傳回

entityType2 最接近的一般父代,如果它們沒有通用父系, entityType1 則為 null。

屬性

適用於