ChangeAction ChangeAction ChangeAction ChangeAction Enum


描述在将更改提交到数据库时实体将具有的更改的类型。Describes the type of change the entity will undergo when changes are submitted to the database.

public enum class ChangeAction
public enum ChangeAction
type ChangeAction = 
Public Enum ChangeAction


Delete Delete Delete Delete 1

将删除该实体。The entity will be deleted.

Insert Insert Insert Insert 2

将插入该实体。The entity will be inserted.

None None None None 0

将不会提交该实体。The entity will not be submitted.

Update Update Update Update 3

将更新该实体。The entity will be updated.


void OnValidate(ChangeAction action)
    if (action == ChangeAction.Insert)
        Console.WriteLine("Notify billing office.");
Public Sub OnValidate(ByVal action As System.Data.Linq.ChangeAction)
    If action = ChangeAction.Insert Then
        Console.WriteLine("Notify billing office.")
    End If
End Sub


在应用OnValidate()程序LINQ to SQLLINQ to SQL中将与结合使用, 以根据要提交的更改类型来指定或忽略验证。Use with OnValidate() in LINQ to SQLLINQ to SQL applications to specify or omit validation based on the type of change being submitted.