Delen via


DbContextOptionsBuilder.EnableDetailedErrors(Boolean) Method

Definition

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