Table of Contents

Class DbUpdateException

Namespace
Microsoft.EntityFrameworkCore
Assembly
Microsoft.EntityFrameworkCore.dll

An exception that is thrown when an error is encountered while saving to the database.

public class DbUpdateException : Exception, ISerializable
Inheritance
DbUpdateException
Implements
Derived
Inherited Members

Remarks

See Saving data with EF Core for more information and examples.

Constructors

DbUpdateException()

Initializes a new instance of the DbUpdateException class.

public DbUpdateException()

DbUpdateException(SerializationInfo, StreamingContext)

Initializes a new instance of the DbUpdateException class from a serialized form.

[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")]
public DbUpdateException(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

The serialization info.

context StreamingContext

The streaming context being used.

DbUpdateException(string)

Initializes a new instance of the DbUpdateException class.

public DbUpdateException(string message)

Parameters

message string

The error message that explains the reason for the exception.

DbUpdateException(string, IReadOnlyList<EntityEntry>)

Initializes a new instance of the DbUpdateException class.

public DbUpdateException(string message, IReadOnlyList<EntityEntry> entries)

Parameters

message string

The error message that explains the reason for the exception.

entries IReadOnlyList<EntityEntry>

The entries that were involved in the error.

DbUpdateException(string, IReadOnlyList<IUpdateEntry>)

Initializes a new instance of the DbUpdateException class.

public DbUpdateException(string message, IReadOnlyList<IUpdateEntry> entries)

Parameters

message string

The error message that explains the reason for the exception.

entries IReadOnlyList<IUpdateEntry>

The entries that were involved in the error.

DbUpdateException(string, Exception?)

Initializes a new instance of the DbUpdateException class.

public DbUpdateException(string message, Exception? innerException)

Parameters

message string

The error message that explains the reason for the exception.

innerException Exception

The exception that is the cause of the current exception.

DbUpdateException(string, Exception?, IReadOnlyList<EntityEntry>)

Initializes a new instance of the DbUpdateException class.

public DbUpdateException(string message, Exception? innerException, IReadOnlyList<EntityEntry> entries)

Parameters

message string

The error message that explains the reason for the exception.

innerException Exception

The exception that is the cause of the current exception.

entries IReadOnlyList<EntityEntry>

The entries that were involved in the error.

DbUpdateException(string, Exception?, IReadOnlyList<IUpdateEntry>)

Initializes a new instance of the DbUpdateException class.

public DbUpdateException(string message, Exception? innerException, IReadOnlyList<IUpdateEntry> entries)

Parameters

message string

The error message that explains the reason for the exception.

innerException Exception

The exception that is the cause of the current exception.

entries IReadOnlyList<IUpdateEntry>

The entries that were involved in the error.

Properties

Entries

Gets the entries that were involved in the error. Typically this is a single entry, but in some cases it may be zero or multiple entries.

public virtual IReadOnlyList<EntityEntry> Entries { get; }

Property Value

IReadOnlyList<EntityEntry>