Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

DbContextOptionsBuilder.EnableDetailedErrors(Boolean) Method

Definition

Namespace:
Microsoft.EntityFrameworkCore
Assembly:
Microsoft.EntityFrameworkCore.dll
Package:
Microsoft.EntityFrameworkCore v10.0.0
Package:
Microsoft.EntityFrameworkCore v2.2.6
Package:
Microsoft.EntityFrameworkCore v3.0.0
Package:
Microsoft.EntityFrameworkCore v3.1.0
Package:
Microsoft.EntityFrameworkCore v5.0.0
Package:
Microsoft.EntityFrameworkCore v6.0.0
Package:
Microsoft.EntityFrameworkCore v7.0.0
Package:
Microsoft.EntityFrameworkCore v8.0.0
Package:
Microsoft.EntityFrameworkCore v9.0.0
Source:
DbContextOptionsBuilder.cs
Source:
DbContextOptionsBuilder.cs
Source:
DbContextOptionsBuilder.cs
Source:
DbContextOptionsBuilder.cs
Source:
DbContextOptionsBuilder.cs
Source:
DbContextOptionsBuilder.cs
Source:
DbContextOptionsBuilder.cs
Source:
DbContextOptionsBuilder.cs
Source:
DbContextOptionsBuilder.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Enables detailed errors when handling of data value exceptions that occur during processing of store query results. Such errors most often occur due to misconfiguration of entity properties. E.g. If a property is configured to be of type 'int', but the underlying data in the store is actually of type 'string', then an exception will be generated at runtime during processing of the data value. When this option is enabled and a data error is encountered, the generated exception will include details of the specific entity property that generated the error.

public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder EnableDetailedErrors(bool detailedErrorsEnabled = true);
abstract member EnableDetailedErrors : bool -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
override this.EnableDetailedErrors : bool -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
Public Overridable Function EnableDetailedErrors (Optional detailedErrorsEnabled As Boolean = true) As DbContextOptionsBuilder

Parameters

detailedErrorsEnabled
Boolean

Returns

The same builder instance so that multiple calls can be chained.

Remarks

Enabling this option incurs a small performance overhead during query execution.

Note that if the application is setting the internal service provider through a call to UseInternalServiceProvider(IServiceProvider), then this option must configured the same way for all uses of that service provider. Consider instead not calling UseInternalServiceProvider(IServiceProvider) so that EF will manage the service providers and can create new instances as required.

See Using DbContextOptions and Logging for more information and examples.

Applies to


Feedback

Was this page helpful?