Share via


IConventionAnnotatable 接口

定义

一个公开可修改的批注的类。 批注允许将任意元数据存储在 对象上。

此接口通常由数据库提供程序 (和其他扩展) 使用。 它通常不用于应用程序代码。

public interface IConventionAnnotatable : Microsoft.EntityFrameworkCore.Infrastructure.IAnnotatable
public interface IConventionAnnotatable : Microsoft.EntityFrameworkCore.Infrastructure.IReadOnlyAnnotatable
type IConventionAnnotatable = interface
    interface IAnnotatable
type IConventionAnnotatable = interface
    interface IReadOnlyAnnotatable
Public Interface IConventionAnnotatable
Implements IAnnotatable
Public Interface IConventionAnnotatable
Implements IReadOnlyAnnotatable
派生
实现

注解

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

属性

Builder

获取可用于配置此对象的生成器。

IsInModel

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

Item[String]

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

(继承自 IReadOnlyAnnotatable)

方法

AddAnnotation(String, Object, Boolean)

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

AddAnnotations(IEnumerable<IConventionAnnotation>, Boolean)

向 对象添加批注。

AddRuntimeAnnotation(String, Object)

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

(继承自 IAnnotatable)
AnnotationsToDebugString(Int32)

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

(继承自 IReadOnlyAnnotatable)
FindAnnotation(String)

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

FindRuntimeAnnotation(String)

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

(继承自 IAnnotatable)
FindRuntimeAnnotationValue(String)

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

(继承自 IAnnotatable)
GetAnnotation(String)

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

GetAnnotations()

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

GetOrAddRuntimeAnnotationValue<TValue,TArg>(String, Func<TArg,TValue>, TArg)

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

(继承自 IAnnotatable)
GetRuntimeAnnotations()

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

(继承自 IAnnotatable)
RemoveAnnotation(String)

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

RemoveRuntimeAnnotation(String)

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

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

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

SetOrRemoveAnnotation(String, Object, Boolean)

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

SetRuntimeAnnotation(String, Object)

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

(继承自 IAnnotatable)

扩展方法

AddAnnotations(IConventionAnnotatable, IEnumerable<IConventionAnnotation>, Boolean)

向 对象添加批注。

GetAnnotation(IConventionAnnotatable, String)

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

SetOrRemoveAnnotation(IConventionAnnotatable, String, Object, Boolean)

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

AnnotationsToDebugString(IAnnotatable, Int32)

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

GetAnnotation(IAnnotatable, String)

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

适用于