Class WarningsConfigurationBuilder
- Namespace
- Microsoft.EntityFrameworkCore.Diagnostics
- Assembly
- Microsoft.EntityFrameworkCore.dll
Configures the runtime behavior of events generated by Entity Framework. You can set a default behavior and behaviors for each event ID.
This class is used within the ConfigureWarnings(Action<WarningsConfigurationBuilder>) API and it is not designed to be directly constructed in your application code.
public class WarningsConfigurationBuilder
- Inheritance
-
WarningsConfigurationBuilder
- Inherited Members
Remarks
See Configuration for specific messages for more information and examples.
Constructors
WarningsConfigurationBuilder(DbContextOptionsBuilder)
Initializes a new instance of the WarningsConfigurationBuilder class.
public WarningsConfigurationBuilder(DbContextOptionsBuilder optionsBuilder)
Parameters
optionsBuilder
DbContextOptionsBuilderThe options builder to which the warnings configuration will be applied.
Methods
Default(WarningBehavior)
Sets the default behavior when a warning is generated.
public virtual WarningsConfigurationBuilder Default(WarningBehavior warningBehavior)
Parameters
warningBehavior
WarningBehaviorThe desired behavior.
Returns
- WarningsConfigurationBuilder
The same builder instance so that multiple calls can be chained.
Remarks
Event ID values can be found in CoreEventId and Microsoft.EntityFrameworkCore.Diagnostics.RelationalEventId. The database provider being used may also define provider-specific event IDs in a similar class.
See Configuration for specific messages for more information and examples.
Ignore(params EventId[])
Causes nothing to happen when the specified event occurs, regardless of default configuration.
public virtual WarningsConfigurationBuilder Ignore(params EventId[] eventIds)
Parameters
eventIds
EventId[]The IDs for events to configure.
Returns
- WarningsConfigurationBuilder
The same builder instance so that multiple calls can be chained.
Remarks
Event ID values can be found in CoreEventId and Microsoft.EntityFrameworkCore.Diagnostics.RelationalEventId. The database provider being used may also define provider-specific event IDs in a similar class.
See Configuration for specific messages for more information and examples.
Log(params EventId[])
Causes an event to be logged, regardless of default configuration.
public virtual WarningsConfigurationBuilder Log(params EventId[] eventIds)
Parameters
eventIds
EventId[]The IDs for events to configure.
Returns
- WarningsConfigurationBuilder
The same builder instance so that multiple calls can be chained.
Remarks
Event ID values can be found in CoreEventId and Microsoft.EntityFrameworkCore.Diagnostics.RelationalEventId. The database provider being used may also define provider-specific event IDs in a similar class.
See Configuration for specific messages for more information and examples.
Log(params (EventId Id, LogLevel Level)[])
Causes an event to be logged at the specified level, regardless of default configuration.
public virtual WarningsConfigurationBuilder Log(params (EventId Id, LogLevel Level)[] eventsAndLevels)
Parameters
Returns
- WarningsConfigurationBuilder
The same builder instance so that multiple calls can be chained.
Remarks
Event ID values can be found in CoreEventId and Microsoft.EntityFrameworkCore.Diagnostics.RelationalEventId. The database provider being used may also define provider-specific event IDs in a similar class.
See Configuration for specific messages for more information and examples.
Throw(params EventId[])
Causes an exception to be thrown when the specified event occurs, regardless of default configuration.
public virtual WarningsConfigurationBuilder Throw(params EventId[] eventIds)
Parameters
eventIds
EventId[]The IDs for events to configure.
Returns
- WarningsConfigurationBuilder
The same builder instance so that multiple calls can be chained.
Remarks
Event ID values can be found in CoreEventId and Microsoft.EntityFrameworkCore.Diagnostics.RelationalEventId. The database provider being used may also define provider-specific event IDs in a similar class.
See Configuration for specific messages for more information and examples.