Share via


ObjectContextOptions.UseConsistentNullReferenceBehavior Property

Definition

Gets or sets a Boolean value that determines whether to use the consistent NullReference behavior.

public bool UseConsistentNullReferenceBehavior { get; set; }
member this.UseConsistentNullReferenceBehavior : bool with get, set
Public Property UseConsistentNullReferenceBehavior As Boolean

Property Value

true if the consistent NullReference behavior should be used; otherwise, false.

Remarks

If this flag is set to false then setting the Value property of the EntityReference<TEntity> for an FK relationship to null when it is already null will have no effect. When this flag is set to true, then setting the value to null will always cause the FK to be nulled and the relationship to be deleted even if the value is currently null. The default value is false when using ObjectContext and true when using DbContext.

Applies to