Share via


IConventionNavigation 接口

定义

表示可用于导航关系的导航属性。

public interface IConventionNavigation : Microsoft.EntityFrameworkCore.Metadata.IConventionPropertyBase, Microsoft.EntityFrameworkCore.Metadata.INavigation
public interface IConventionNavigation : Microsoft.EntityFrameworkCore.Metadata.IConventionNavigationBase, Microsoft.EntityFrameworkCore.Metadata.INavigation
public interface IConventionNavigation : Microsoft.EntityFrameworkCore.Metadata.IConventionNavigationBase, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyNavigation
type IConventionNavigation = interface
    interface INavigation
    interface IPropertyBase
    interface IAnnotatable
    interface IConventionPropertyBase
    interface IConventionAnnotatable
type IConventionNavigation = interface
    interface INavigation
    interface INavigationBase
    interface IPropertyBase
    interface IAnnotatable
    interface IConventionNavigationBase
    interface IConventionPropertyBase
    interface IConventionAnnotatable
type IConventionNavigation = interface
    interface IReadOnlyNavigation
    interface IReadOnlyNavigationBase
    interface IReadOnlyPropertyBase
    interface IReadOnlyAnnotatable
    interface IConventionNavigationBase
    interface IConventionPropertyBase
    interface IConventionAnnotatable
Public Interface IConventionNavigation
Implements IConventionPropertyBase, INavigation
Public Interface IConventionNavigation
Implements IConventionNavigationBase, INavigation
Public Interface IConventionNavigation
Implements IConventionNavigationBase, IReadOnlyNavigation
实现

注解

此接口在模型创建期间使用,并允许修改元数据。 生成模型后, INavigation 表示相同元数据的只读视图。

有关详细信息和示例,请参阅 模型生成约定

属性

Builder

获取可用于配置此导航的生成器。

ClrType

获取此类似属性的对象包含的值的类型。

(继承自 IReadOnlyPropertyBase)
DeclaringEntityType

获取此导航属性所属的类型。

DeclaringType

获取此属性类对象所属的类型。

(继承自 IReadOnlyPropertyBase)
FieldInfo

FieldInfo获取此属性类似对象的基础 CLR 字段的 。 这可能 null 适用于阴影属性,或者如果支持字段未知。

(继承自 IReadOnlyPropertyBase)
ForeignKey

获取定义此导航属性将导航的关系的外键。

Inverse

获取反向导航。

IsCollection

获取一个值,该值指示导航属性是否为集合属性。

(继承自 IReadOnlyNavigationBase)
IsEagerLoaded

获取一个值,该值指示默认情况下是否应预先加载此导航。

(继承自 IReadOnlyNavigationBase)
IsInModel

指示此对象是否在模型中,即尚未从模型中删除。

(继承自 IConventionAnnotatable)
IsOnDependent

获取一个值,该值指示导航属性是否在基础外键的依赖端定义。

(继承自 IReadOnlyNavigation)
Item[String]

获取具有给定名称的批注的值,如果不存在,则返回 null

(继承自 IReadOnlyAnnotatable)
LazyLoadingEnabled

确定如果启用了延迟加载并且模型中配置了延迟加载机制,则此导航是否应延迟加载。

(继承自 IReadOnlyNavigationBase)
Name

获取此属性类似对象的名称。

(继承自 IReadOnlyPropertyBase)
PropertyInfo

PropertyInfo获取类似于此属性的对象的基础 CLR 属性的 。 这可能 null 适用于阴影属性或直接映射到字段。

(继承自 IReadOnlyPropertyBase)
Sentinel

获取 sentinel 值,该值指示未设置此属性。

(继承自 IReadOnlyPropertyBase)
TargetEntityType

获取此导航属性将保存实例 () 的实体类型。

方法

AddAnnotation(String, Object, Boolean)

向此对象添加批注。 如果已存在具有指定名称的批注,则引发 。

(继承自 IConventionAnnotatable)
AddAnnotations(IEnumerable<IConventionAnnotation>, Boolean)

向 对象添加批注。

(继承自 IConventionAnnotatable)
AddRuntimeAnnotation(String, Object)

向此对象添加运行时批注。 如果已存在具有指定名称的批注,则引发 。

(继承自 IAnnotatable)
AnnotationsToDebugString(Int32)

获取对象上声明的所有注释的调试字符串。

(继承自 IReadOnlyAnnotatable)
FindAnnotation(String)

获取具有给定名称的批注,如果不存在,则返回 null

(继承自 IReadOnlyAnnotatable)
FindRuntimeAnnotation(String)

获取具有给定名称的运行时注释,如果不存在,则返回 null

(继承自 IAnnotatable)
FindRuntimeAnnotationValue(String)

获取具有给定名称的运行时注释的值,如果不存在,则返回 null

(继承自 IAnnotatable)
GetAnnotation(String)

获取具有给定名称的批注,如果不存在,则引发该批注。

(继承自 IReadOnlyAnnotatable)
GetAnnotations()

获取当前 对象上的所有注释。

(继承自 IReadOnlyAnnotatable)
GetCollectionAccessor()

IClrCollectionAccessor获取此导航属性的 (如果它是集合导航)。

(继承自 INavigationBase)
GetConfigurationSource()

返回此属性的配置源。

(继承自 IConventionPropertyBase)
GetCurrentValueComparer()

IComparer<T>获取用于比较跟踪IUpdateEntry条目中的值的 。

(继承自 IPropertyBase)
GetFieldInfoConfigurationSource()

返回 的配置 FieldInfo源。

(继承自 IConventionPropertyBase)
GetFieldName()

获取此属性的后备字段的名称,或者 null 如果后备字段未知,则为 。

(继承自 IReadOnlyPropertyBase)
GetGetter()

获取 IClrPropertyGetter 用于读取此属性的值的 。

(继承自 IPropertyBase)
GetIndex()

获取此属性的属性索引。

(继承自 IPropertyBase)
GetInverseConfigurationSource()

返回 的配置 Inverse源。

GetIsEagerLoadedConfigurationSource()

返回 的配置 IsEagerLoaded源。

(继承自 IConventionNavigationBase)
GetLazyLoadingEnabledConfigurationSource()

返回 的配置 LazyLoadingEnabled源。

(继承自 IConventionNavigationBase)
GetMemberInfo(Boolean, Boolean)

PropertyInfo获取应用于获取或设置给定属性的值的 或 FieldInfo

(继承自 IPropertyBase)
GetOrAddRuntimeAnnotationValue<TValue,TArg>(String, Func<TArg,TValue>, TArg)

获取具有给定名称的运行时注释的值,如果不存在,则添加该值。

(继承自 IAnnotatable)
GetPropertyAccessMode()

PropertyAccessMode获取用于此属性类似对象的 。

(继承自 IReadOnlyPropertyBase)
GetPropertyAccessModeConfigurationSource()

返回 的配置 GetPropertyAccessMode()源。

(继承自 IConventionPropertyBase)
GetRuntimeAnnotations()

获取当前 对象上的所有运行时注释。

(继承自 IAnnotatable)
IsIndexerProperty()

获取一个值,该值指示此是否为索引器属性。 索引器属性是通过实体类上的索引器访问的属性。

(继承自 IReadOnlyPropertyBase)
IsShadowProperty()

获取一个值,该值指示此是否为阴影属性。 阴影属性是实体类中没有相应属性的阴影属性。 属性的当前值存储在 中, ChangeTracker 而不是存储在实体类的实例中。

(继承自 IReadOnlyPropertyBase)
RemoveAnnotation(String)

从此 对象中删除具有给定名称的批注。

(继承自 IConventionAnnotatable)
RemoveRuntimeAnnotation(String)

从此 对象中删除给定的运行时批注。

(继承自 IAnnotatable)
SetAnnotation(String, Object, Boolean)

设置存储在给定名称下的批注。 如果具有指定名称的批注已存在,则覆盖现有批注。

(继承自 IConventionAnnotatable)
SetField(FieldInfo, Boolean)
已过时。.

FieldInfo设置此属性应使用的基础 CLR 字段的 。

默认情况下,在构造新对象时(通常是从数据库查询实体时),将使用支持字段(如果找到或已指定)。 属性用于所有其他访问。 这可以通过调用 SetPropertyAccessMode(Nullable<PropertyAccessMode>, Boolean)进行更改。

(继承自 IConventionPropertyBase)
SetField(String, Boolean)

设置此属性应使用的基础 CLR 字段。 这可能 null 适用于阴影属性,或者如果属性的后备字段未知,则为 。

(继承自 IConventionPropertyBase)
SetFieldInfo(FieldInfo, Boolean)

FieldInfo设置此属性应使用的基础 CLR 字段的 。

(继承自 IConventionPropertyBase)
SetInverse(MemberInfo, Boolean)

设置反向导航。

SetInverse(String, Boolean)

设置反向导航。

SetIsEagerLoaded(Nullable<Boolean>, Boolean)

设置一个值,该值指示默认情况下是否应预先加载此导航。

(继承自 IConventionNavigationBase)
SetIsLoadedWhenNoTracking(Object)

调用 SetLoaded(Object, String, Boolean)INavigationBase 在无跟踪查询预先加载此关系时将其标记为已加载。

(继承自 INavigationBase)
SetLazyLoadingEnabled(Nullable<Boolean>, Boolean)

设置一个值,该值指示是否应延迟加载此导航,如果启用延迟加载并且已就地加载。

(继承自 IConventionNavigationBase)
SetOrRemoveAnnotation(String, Object, Boolean)

设置存储在给定名称下的批注。 如果具有指定名称的批注已存在,则覆盖现有批注。 如果 null 提供了 ,则删除现有批注。

(继承自 IConventionAnnotatable)
SetPropertyAccessMode(Nullable<PropertyAccessMode>, Boolean)

PropertyAccessMode设置要用于此属性的 。

(继承自 IConventionPropertyBase)
SetRuntimeAnnotation(String, Object)

设置存储在给定键下的运行时注释。 如果具有指定名称的批注已存在,则覆盖现有批注。

(继承自 IAnnotatable)
ToDebugString(MetadataDebugStringOptions, Int32)

创建给定元数据的可读表示形式。

警告:不要依赖于返回的字符串的格式。 它仅用于调试,可能会在发布之间任意更改。

(继承自 IReadOnlyNavigation)

显式接口实现

IConventionPropertyBase.GetConfigurationSource()

返回此导航属性的配置源。

INavigationBase.DeclaringEntityType

获取此导航属性所属的实体类型。

(继承自 INavigation)
INavigationBase.GetCollectionAccessor()

IClrCollectionAccessor获取此导航属性的 (如果它是集合导航)。

(继承自 INavigation)
INavigationBase.Inverse

获取反向导航。

(继承自 INavigation)
INavigationBase.IsCollection

获取一个值,该值指示导航属性是否为集合属性。

(继承自 INavigation)
INavigationBase.TargetEntityType

获取此导航属性将保存实例 () 的实体类型。

(继承自 INavigation)
IPropertyBase.GetPropertyAccessMode()

获取 PropertyAccessMode 用于此属性的 。 null 指示正在使用默认属性访问模式。

(继承自 INavigationBase)
IReadOnlyNavigationBase.DeclaringEntityType

获取此导航属性所属的实体类型。

(继承自 IReadOnlyNavigation)
IReadOnlyNavigationBase.Inverse

获取反向导航。

(继承自 IReadOnlyNavigation)
IReadOnlyNavigationBase.IsCollection

获取一个值,该值指示导航属性是否为集合属性。

(继承自 IReadOnlyNavigation)
IReadOnlyNavigationBase.TargetEntityType

获取此导航属性将包含实例 () 的实体类型。

(继承自 IReadOnlyNavigation)
IReadOnlyPropertyBase.IsShadowProperty()

获取一个值,该值指示此是否为阴影属性。 阴影属性是实体类中没有相应属性的阴影属性。 属性的当前值存储在 中, ChangeTracker 而不是存储在实体类的实例中。

(继承自 IReadOnlyNavigationBase)

扩展方法

AddAnnotations(IConventionAnnotatable, IEnumerable<IConventionAnnotation>, Boolean)

向 对象添加批注。

GetAnnotation(IConventionAnnotatable, String)

获取具有给定名称的批注,如果不存在,则引发该批注。

SetOrRemoveAnnotation(IConventionAnnotatable, String, Object, Boolean)

设置存储在给定名称下的批注。 如果具有指定名称的批注已存在,则覆盖现有批注。 如果 null 提供了 ,则删除现有批注。

FindInverse(IConventionNavigation)
已过时。.

获取关系另一端的导航属性。 如果在关系的另一端没有定义导航属性,则返回 null。

GetIsEagerLoadedConfigurationSource(IConventionNavigation)

返回 的配置 IsEagerLoaded(INavigation)源。

GetTargetType(IConventionNavigation)
已过时。.

获取给定导航属性将保存 (实例的实体类型,如果它是集合导航) ,则保留 实例。

SetIsEagerLoaded(IConventionNavigation, Nullable<Boolean>, Boolean)

设置一个值,该值指示默认情况下是否应预先加载此导航。

GetPropertyAccessModeConfigurationSource(IConventionPropertyBase)

返回 的配置 GetPropertyAccessMode()源。

SetField(IConventionPropertyBase, String, Boolean)

设置此属性应使用的基础 CLR 字段。 这可能 null 适用于阴影属性,或者如果属性的后备字段未知,则为 。

支持字段通常按约定找到,如下所述: http://go.microsoft.com/fwlink/?LinkId=723277. 如果按照约定找不到正确的字段,此方法可用于显式设置后备字段。

默认情况下,在构造新对象时(通常是从数据库查询实体时),将使用支持字段(如果找到或已指定)。 属性用于所有其他访问。 这可以通过调用 SetPropertyAccessMode(IConventionPropertyBase, Nullable<PropertyAccessMode>, Boolean)进行更改。

SetPropertyAccessMode(IConventionPropertyBase, Nullable<PropertyAccessMode>, Boolean)

PropertyAccessMode设置要用于此属性的 。

AnnotationsToDebugString(IAnnotatable, Int32)

获取对象上声明的所有注释的调试字符串。

GetAnnotation(IAnnotatable, String)

获取具有给定名称的批注,如果不存在,则引发该批注。

SetIsLoadedWhenNoTracking(INavigationBase, Object)

调用 SetLoaded(Object, String, Boolean)INavigationBase 在无跟踪查询预先加载此关系时将其标记为已加载。

FindInverse(INavigation)
已过时。.
已过时。.

获取关系另一端的导航属性。 如果在关系的另一端没有定义导航属性,则返回 null。

GetCollectionAccessor(INavigation)

IClrCollectionAccessor获取此导航属性的 ,该属性必须是集合导航。

GetTargetType(INavigation)
已过时。.
已过时。.

获取给定导航属性将包含 (实例的实体类型,或者如果它是集合导航) ,则保留 的实例。

IsCollection(INavigation)
已过时。.
已过时。.

获取一个值,该值指示给定的导航属性是否为集合属性。

IsDependentToPrincipal(INavigation)
已过时。.
已过时。.

获取一个值,该值指示给定的导航属性是否是指向主体实体的依赖实体类型的导航属性。

IsEagerLoaded(INavigation)
已过时。.
已过时。.

获取一个值,该值指示默认情况下是否应预先加载此导航。

ToDebugString(INavigation, MetadataDebugStringOptions, Int32)

创建给定元数据的可读表示形式。

警告:不要依赖于返回的字符串的格式。 它仅用于调试,可能会在发布之间任意更改。

GetCurrentValueComparer(IPropertyBase)

获取用于 IComparer<T> 比较跟踪 IUpdateEntry 条目中的值的 。

GetFieldName(IPropertyBase)

获取此属性的后备字段的名称,或者 null 如果后备字段未知,则为 。

GetGetter(IPropertyBase)

IClrPropertyGetter获取用于读取此属性的值的 。

请注意,为阴影属性 IsShadowProperty(IPropertyBase) 调用此方法 () 是错误的,因为此类属性没有关联的 MemberInfo

GetIndex(IPropertyBase)

获取此属性的属性索引。

GetMemberInfo(IPropertyBase, Boolean, Boolean)

PropertyInfo获取应用于获取或设置给定属性的值的 或 FieldInfo

请注意,为阴影属性 IsShadowProperty(IPropertyBase) 调用此方法 () 是错误的,因为此类属性没有关联的 MemberInfo

GetPropertyAccessMode(IPropertyBase)

PropertyAccessMode获取用于此属性的 。 null 指示正在使用默认属性访问模式。

IsIndexerProperty(IPropertyBase)

获取一个值,该值指示此是否为索引器属性。 索引器属性是通过实体类上的索引器访问的属性。

IsShadowProperty(IPropertyBase)
已过时。.

获取一个值,该值指示此是否为阴影属性。 阴影属性是实体类中没有相应属性的阴影属性。 属性的当前值存储在 中, ChangeTracker 而不是存储在实体类的实例中。

适用于