Share via


IMutableServiceProperty 接口

定义

IReadOnlyPropertyBase实体框架模型中的 ,它表示从 DbContext注入的服务。

public interface IMutableServiceProperty : Microsoft.EntityFrameworkCore.Metadata.IMutablePropertyBase, Microsoft.EntityFrameworkCore.Metadata.IServiceProperty
public interface IMutableServiceProperty : Microsoft.EntityFrameworkCore.Metadata.IMutablePropertyBase, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyServiceProperty
type IMutableServiceProperty = interface
    interface IServiceProperty
    interface IPropertyBase
    interface IAnnotatable
    interface IMutablePropertyBase
    interface IMutableAnnotatable
type IMutableServiceProperty = interface
    interface IReadOnlyServiceProperty
    interface IReadOnlyPropertyBase
    interface IReadOnlyAnnotatable
    interface IMutablePropertyBase
    interface IMutableAnnotatable
Public Interface IMutableServiceProperty
Implements IMutablePropertyBase, IServiceProperty
Public Interface IMutableServiceProperty
Implements IMutablePropertyBase, IReadOnlyServiceProperty
实现

注解

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

有关详细信息和示例,请参阅 为实体类型和关系建模

属性

ClrType

获取类似于属性的对象所保留的值的类型。

(继承自 IReadOnlyPropertyBase)
DeclaringEntityType

获取此属性所属的类型。

DeclaringType

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

(继承自 IReadOnlyPropertyBase)
FieldInfo

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

(继承自 IReadOnlyPropertyBase)
Item[String]

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

(继承自 IReadOnlyAnnotatable)
Name

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

(继承自 IReadOnlyPropertyBase)
ParameterBinding

获取或设置 ServiceParameterBinding 此属性。

PropertyInfo

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

(继承自 IReadOnlyPropertyBase)
Sentinel

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

(继承自 IReadOnlyPropertyBase)

方法

AddAnnotation(String, Object)

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

(继承自 IMutableAnnotatable)
AddAnnotations(IEnumerable<IAnnotation>)

向 对象添加批注。

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

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

(继承自 IAnnotatable)
AnnotationsToDebugString(Int32)

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

(继承自 IReadOnlyAnnotatable)
FindAnnotation(String)

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

(继承自 IReadOnlyAnnotatable)
FindRuntimeAnnotation(String)

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

(继承自 IAnnotatable)
FindRuntimeAnnotationValue(String)

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

(继承自 IAnnotatable)
GetAnnotation(String)

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

(继承自 IReadOnlyAnnotatable)
GetAnnotations()

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

(继承自 IReadOnlyAnnotatable)
GetCurrentValueComparer()

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

(继承自 IPropertyBase)
GetFieldName()

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

(继承自 IReadOnlyPropertyBase)
GetGetter()

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

(继承自 IPropertyBase)
GetIndex()

获取此属性的属性索引。

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

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

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

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

(继承自 IAnnotatable)
GetPropertyAccessMode()

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

(继承自 IReadOnlyPropertyBase)
GetRuntimeAnnotations()

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

(继承自 IAnnotatable)
IsIndexerProperty()

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

(继承自 IReadOnlyPropertyBase)
IsShadowProperty()

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

(继承自 IReadOnlyPropertyBase)
RemoveAnnotation(String)

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

(继承自 IMutableAnnotatable)
RemoveRuntimeAnnotation(String)

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

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

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

(继承自 IMutableAnnotatable)
SetField(String)

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

(继承自 IMutablePropertyBase)
SetOrRemoveAnnotation(String, Object)

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

(继承自 IMutableAnnotatable)
SetPropertyAccessMode(Nullable<PropertyAccessMode>)

PropertyAccessMode设置要用于此属性的 。

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

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

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

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

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

(继承自 IReadOnlyServiceProperty)

扩展方法

AnnotationsToDebugString(IAnnotatable, Int32)

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

GetAnnotation(IAnnotatable, String)

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

AddAnnotations(IMutableAnnotatable, IEnumerable<IAnnotation>)

向 对象添加批注。

GetAnnotation(IMutableAnnotatable, String)

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

GetOrAddAnnotation(IMutableAnnotatable, String, String)

获取具有给定键的现有批注,或添加新批注(如果不存在)。

SetOrRemoveAnnotation(IMutableAnnotatable, String, Object)

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

SetField(IMutablePropertyBase, String)

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

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

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

SetPropertyAccessMode(IMutablePropertyBase, Nullable<PropertyAccessMode>)

PropertyAccessMode设置要用于此属性的 。

SetPropertyAccessMode(IMutablePropertyBase, Nullable<PropertyAccessMode>)

PropertyAccessMode设置要用于此属性的 。

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 而不是存储在实体类的实例中。

ToDebugString(IServiceProperty, MetadataDebugStringOptions, Int32)

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

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

适用于