Delen via


DeleteBehavior Enum

Definition

Indicates how a delete operation is applied to dependent entities in a relationship when the principal is deleted or the relationship is severed.

public enum DeleteBehavior
type DeleteBehavior = 
Public Enum DeleteBehavior
Inheritance
DeleteBehavior

Fields

Name Value Description
Restrict 0

The delete operation is not applied to dependent entities. The dependent entities remain unchanged.

SetNull 1

The foreign key properties in dependent entities are set to null. This cascading behavior is only applied to entities that are being tracked by the context. A corresponding cascade behavior should be setup in the database to ensure data that is not being tracked by the context has the same action applied. If you use EF to create the database, this cascade behavior will be setup for you.

Cascade 2

Dependent entities are also deleted. This cascading behavior is only applied to entities that are being tracked by the context. A corresponding cascade behavior should be setup in the database to ensure data that is not being tracked by the context has the same action applied. If you use EF to create the database, this cascade behavior will be setup for you.

Applies to