ObjectContextOptions.UseConsistentNullReferenceBehavior Property

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.Data.Objects
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public bool UseConsistentNullReferenceBehavior { get; set; }

Property Value

Type: System.Boolean

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

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.

.NET Framework
Available since 4.5
Return to top