MigrationOperation 类

定义

可对数据库执行的所有迁移操作的基类。

public abstract class MigrationOperation : Microsoft.EntityFrameworkCore.Infrastructure.Annotatable
type MigrationOperation = class
    inherit Annotatable
Public MustInherit Class MigrationOperation
Inherits Annotatable
继承
MigrationOperation
继承
MigrationOperation
派生

注解

有关详细信息和示例 ,请参阅数据库迁移

构造函数

MigrationOperation()

可对数据库执行的所有迁移操作的基类。

属性

IsDestructiveChange

指示操作是否可能导致数据库中的数据丢失。

IsReadOnly

指示当前对象是否为只读对象。

(继承自 AnnotatableBase)
Item[String]

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

(继承自 Annotatable)

方法

AddAnnotation(String, Annotation)

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

(继承自 Annotatable)
AddAnnotation(String, Object)

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

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

向此对象添加批注。

(继承自 AnnotatableBase)
AddAnnotations(IReadOnlyDictionary<String,Object>)

向此对象添加批注。

(继承自 AnnotatableBase)
AddRuntimeAnnotation(String, Annotation)

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

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

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

(继承自 AnnotatableBase)
AddRuntimeAnnotations(IEnumerable<Annotation>)

向此对象添加运行时批注。

(继承自 AnnotatableBase)
AddRuntimeAnnotations(IReadOnlyDictionary<String,Object>)

向此对象添加运行时批注。

(继承自 AnnotatableBase)
CreateAnnotation(String, Object)

创建新批注。

(继承自 Annotatable)
CreateRuntimeAnnotation(String, Object)

创建新的运行时批注。

(继承自 AnnotatableBase)
EnsureMutable()

如果模型为只读,则引发 。

(继承自 Annotatable)
EnsureReadOnly()

如果模型不是只读的,则引发 。

(继承自 Annotatable)
FindAnnotation(String)

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

(继承自 Annotatable)
FindRuntimeAnnotation(String)

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

(继承自 AnnotatableBase)
GetAnnotation(String)

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

(继承自 AnnotatableBase)
GetAnnotations()

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

(继承自 Annotatable)
GetOrAddAnnotation(String, Object)

向此对象添加批注,或返回现有批注(如果已存在具有指定名称的注释)。

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

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

(继承自 AnnotatableBase)
GetRuntimeAnnotations()

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

(继承自 AnnotatableBase)
OnAnnotationSet(String, Annotation, Annotation)

在设置或删除批注时调用。

(继承自 Annotatable)
RemoveAnnotation(String)

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

(继承自 Annotatable)
RemoveRuntimeAnnotation(String)

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

(继承自 AnnotatableBase)
SetAnnotation(String, Annotation)

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

(继承自 Annotatable)
SetAnnotation(String, Annotation, Annotation)

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

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

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

(继承自 Annotatable)
SetRuntimeAnnotation(String, Annotation, Annotation)

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

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

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

(继承自 AnnotatableBase)

显式接口实现

IAnnotatable.AddRuntimeAnnotation(String, Object)

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

(继承自 AnnotatableBase)
IAnnotatable.FindAnnotation(String)

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

(继承自 Annotatable)
IAnnotatable.FindRuntimeAnnotation(String)

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

(继承自 AnnotatableBase)
IAnnotatable.GetAnnotations()

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

(继承自 Annotatable)
IAnnotatable.GetRuntimeAnnotations()

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

(继承自 AnnotatableBase)
IAnnotatable.RemoveRuntimeAnnotation(String)

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

(继承自 AnnotatableBase)
IAnnotatable.SetRuntimeAnnotation(String, Object)

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

(继承自 AnnotatableBase)
IMutableAnnotatable.AddAnnotation(String, Object)

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

(继承自 Annotatable)
IMutableAnnotatable.RemoveAnnotation(String)

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

(继承自 Annotatable)
IMutableAnnotatable.SetOrRemoveAnnotation(String, Object)

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

(继承自 Annotatable)
IReadOnlyAnnotatable.FindAnnotation(String)

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

(继承自 AnnotatableBase)
IReadOnlyAnnotatable.GetAnnotations()

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

(继承自 AnnotatableBase)
IReadOnlyAnnotatable.Item[String]

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

(继承自 AnnotatableBase)

扩展方法

AnnotationsToDebugString(IAnnotatable, Int32)

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

GetAnnotation(IAnnotatable, String)

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

AddAnnotations(IMutableAnnotatable, IEnumerable<IAnnotation>)

向 对象添加批注。

GetAnnotation(IMutableAnnotatable, String)

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

GetOrAddAnnotation(IMutableAnnotatable, String, String)

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

SetOrRemoveAnnotation(IMutableAnnotatable, String, Object)

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

适用于