Microsoft.EntityFrameworkCore.Diagnostics Namespace

Classes

AbstractionsStrings

String resources used in EF exceptions, etc.

These strings are exposed publicly for use by database providers and extensions. It is unusual for application code to need these strings.

BatchEventData

The DiagnosticSource event payload for RelationalEventId batch events.

BinaryExpressionEventData

A DiagnosticSource event payload class for events that have a query expression.

CascadeDeleteEventData

A DiagnosticSource event payload class for events that indicate an entity is being deleted because its parent entity has been deleted.

CascadeDeleteOrphanEventData

A DiagnosticSource event payload class for events that indicate an entity is being deleted because its required relationship to a parent has been severed.

CollectionChangedEventData

A DiagnosticSource event payload class for events that indicate a collection navigation property has had entities added and/or removed.

CommandCorrelatedEventData

The DiagnosticSource event payload for events correlated with a DbCommand.

CommandEndEventData

The DiagnosticSource event payload for RelationalEventId command end events.

CommandErrorEventData

The DiagnosticSource event payload for CommandError.

CommandEventData

The DiagnosticSource event payload for RelationalEventId command events.

CommandExecutedEventData

The DiagnosticSource event payload for CommandExecuted.

ConflictingValueGenerationStrategiesEventData

A DiagnosticSource event payload class for events that have a property.

ConnectionEndEventData

The DiagnosticSource event payload class for RelationalEventId connection ending events.

ConnectionErrorEventData

The DiagnosticSource event payload for ConnectionError.

ConnectionEventData

The DiagnosticSource event payload base class for RelationalEventId connection events.

ContextInitializedEventData

A DiagnosticSource event payload class for context initialization events.

CoreEventId

Event IDs for events that correspond to messages logged to an ILogger and events sent to a DiagnosticSource.

These IDs are also used with WarningsConfigurationBuilder to configure the behavior of warnings.

CoreLoggerExtensions

This class contains static methods used by EF Core internals and database providers to write information to an ILogger and a DiagnosticListener for well-known events.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

CoreStrings

String resources used in EF exceptions, etc.

These strings are exposed publicly for use by database providers and extensions. It is unusual for application code to need these strings.

CosmosEventId

Event IDs for Cosmos events that correspond to messages logged to an ILogger and events sent to a DiagnosticSource.

These IDs are also used with WarningsConfigurationBuilder to configure the behavior of warnings.

DataReaderDisposingEventData

DiagnosticSource event payload for DataReaderDisposing.

DbCommandInterceptor

Abstract base class for IDbCommandInterceptor for use when implementing a subset of the interface methods.

DbConnectionInterceptor

Abstract base class for IDbConnectionInterceptor for use when implementing a subset of the interface methods.

DbContextErrorEventData

A DiagnosticSource event payload class for error events that reference a DbContext.

DbContextEventData

A DiagnosticSource event payload class for events that reference a DbContext.

DbContextTypeErrorEventData

A DiagnosticSource event payload class for error events that reference a DbContext type.

DbContextTypeEventData

A DiagnosticSource event payload class for events that reference a DbContext type.

DbTransactionInterceptor

Abstract base class for IDbTransactionInterceptor for use when implementing a subset of the interface methods.

EntityEntryEventData

A DiagnosticSource event payload class for events that reference a EntityEntry.

EntityTypeSchemaEventData

The DiagnosticSource event payload base class for events that reference an entity type and a schema

EventData

A base class for all Entity Framework DiagnosticSource event payloads.

EventDefinition

Defines metadata for an event with no parameters and a cached delegate to log the event with reduced allocations.

EventDefinition<TParam>

Defines metadata for an event with one parameter and a cached delegate to log the event with reduced allocations.

EventDefinition<TParam1,TParam2>

Defines metadata for an event with three parameters and a cached delegate to log the event with reduced allocations.

EventDefinition<TParam1,TParam2,TParam3>

Defines metadata for an event with three parameters and a cached delegate to log the event with reduced allocations.

EventDefinition<TParam1,TParam2,TParam3,TParam4>

Defines metadata for an event with three parameters and a cached delegate to log the event with reduced allocations.

EventDefinition<TParam1,TParam2,TParam3,TParam4,TParam5>

Defines metadata for an event with three parameters and a cached delegate to log the event with reduced allocations.

EventDefinition<TParam1,TParam2,TParam3,TParam4,TParam5,TParam6>

Defines metadata for an event with three parameters and a cached delegate to log the event with reduced allocations.

EventDefinitionBase

Base class for event definitions.

EventDefinitionBase.MessageExtractingLogger

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

ExecutionStrategyEventData

The DiagnosticSource event payload for CoreEventId execution strategy events.

ExpressionEventData

A DiagnosticSource event payload class for events that have a query expression.

FallbackEventDefinition

Defines metadata for an event with more than six parameters such that it has to have special handling.

ForeignKeyCandidateEventData

A DiagnosticSource event payload class for incompatible foreign key properties.

ForeignKeyEventData

A DiagnosticSource event payload class for events that have a foreign key.

IncludeEventData

A DiagnosticSource event payload class for events that have an Include<TEntity,TProperty>(IQueryable<TEntity>, Expression<Func<TEntity,TProperty>>) specification.

IndexEventData

A DiagnosticSource event payload class for the events involving an invalid index.

IndexWithPropertiesEventData

A DiagnosticSource event payload class for the IndexPropertiesMappedToNonOverlappingTables event.

IndexWithPropertyEventData

A DiagnosticSource event payload class for the events involving an invalid property name on an index.

InMemoryEventId

Event IDs for in-memory events that correspond to messages logged to an ILogger and events sent to a DiagnosticSource.

These IDs are also used with WarningsConfigurationBuilder to configure the behavior of warnings.

InterceptorAggregator<TInterceptor>

Abstract base class for implementations of the IInterceptorAggregator service.

InvalidIncludePathEventData

A DiagnosticSource event payload class for events that have invalid include path information.

LazyLoadingEventData

A DiagnosticSource event payload class for events from ILazyLoader

LoggerCategory<T>

Generic helper class used to implement the Name property.

LoggingDefinitions

Contains placeholders for caching of EventDefinitionBase.

This class is public so that it can be inherited by database providers to add caching for their events. It should not be used for any other purpose.

MigrationAssemblyEventData

The DiagnosticSource event payload for RelationalEventId migrations assembly events.

MigrationEventData

The DiagnosticSource event payload for RelationalEventId events of a specific migration.

MigrationScriptingEventData

The DiagnosticSource event payload for RelationalEventId migration scripting events.

MigrationTypeEventData

The DiagnosticSource event payload for RelationalEventId migration events.

MigratorConnectionEventData

The DiagnosticSource event payload for RelationalEventId migration connection events.

MigratorEventData

The DiagnosticSource event payload for RelationalEventId migration events.

MinBatchSizeEventData

The DiagnosticSource event payload for RelationalEventId min batch size events.

NavigationBaseEventData

A DiagnosticSource event payload class for events that have an INavigationBase.

NavigationEventData

A DiagnosticSource event payload class for events that have an INavigation.

NavigationPathEventData

A DiagnosticSource event payload class for events that have a navigation property.

PropertyChangedEventData

A DiagnosticSource event payload class for events that indicate a changed property value.

PropertyEventData

A DiagnosticSource event payload class for events that have a property.

PropertyValueEventData

A DiagnosticSource event payload class for events that indicate a property value.

QueryExpressionEventData

A DiagnosticSource event payload class for events that have a query expression.

QueryModelClientEvalEventData

A DiagnosticSource event payload class for events that have a query model and an expression.

QueryModelEventData

A DiagnosticSource event payload class for events that have a query model.

ReferenceChangedEventData

A DiagnosticSource event payload class for events that indicate a changed property value.

RelationalEventId

Event IDs for relational events that correspond to messages logged to an ILogger and events sent to a DiagnosticSource.

These IDs are also used with WarningsConfigurationBuilder to configure the behavior of warnings.

RelationalLoggerExtensions

This class contains static methods used by EF Core internals and relational database providers to write information to an ILogger and a DiagnosticListener for well-known events.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

RelationalLoggingDefinitions

Contains placeholders for caching of EventDefinitionBase.

This class is public so that it can be inherited by database providers to add caching for their events. It should not be used for any other purpose.

RelationalStrings

String resources used in EF exceptions, etc.

These strings are exposed publicly for use by database providers and extensions. It is unusual for application code to need these strings.

SaveChangesCompletedEventData

A DiagnosticSource event payload class for events that indicate SaveChanges() has completed.

SaveChangesEventData

A DiagnosticSource event payload class for events that specify the entities being saved and the rows affected.

SaveChangesInterceptor

Abstract base class for ISaveChangesInterceptor for use when implementing a subset of the interface methods.

SequenceEventData

The DiagnosticSource event payload base class for events that reference a sequence.

ServiceProviderDebugInfoEventData

A DiagnosticSource event payload class for events that reference debug information on service provider creation.

ServiceProviderEventData

A DiagnosticSource event payload class for events that reference a IServiceProvider container.

ServiceProvidersEventData

A DiagnosticSource event payload class for events that reference multiple IServiceProvider containers.

SharedDependentEntityEventData

A DiagnosticSource event payload class for events that reference two IEntityType instances.

SkipCollectionChangedEventData

A DiagnosticSource event payload class for events that indicate a skip collection navigation property has had entities added and/or removed.

SkipNavigationEventData

A DiagnosticSource event payload class for events that have an ISkipNavigation.

SqliteEventId

Event IDs for SQLite events that correspond to messages logged to an ILogger and events sent to a DiagnosticSource.

These IDs are also used with WarningsConfigurationBuilder to configure the behavior of warnings.

SqlServerEventId

Event IDs for SQL Server events that correspond to messages logged to an ILogger and events sent to a DiagnosticSource.

These IDs are also used with WarningsConfigurationBuilder to configure the behavior of warnings.

StateChangedEventData

A DiagnosticSource event payload class for events that indicate a change of a tracked entity from one EntityState to another.

TransactionEndEventData

The DiagnosticSource event payload base class for RelationalEventId transaction end events.

TransactionEnlistedEventData

The DiagnosticSource event payload for RelationalEventId transaction enlisted events.

TransactionErrorEventData

The DiagnosticSource event payload base class for RelationalEventId transaction error events.

TransactionEventData

The DiagnosticSource event payload base class for RelationalEventId transaction events.

TransactionStartingEventData

The DiagnosticSource event payload base class for RelationalEventId transaction events.

TwoPropertyBaseCollectionsEventData

A DiagnosticSource event payload class for events that have two property collections.

TwoSqlExpressionsEventData

The DiagnosticSource event payload base class for events that references two SqlExpression.

TwoUnmappedPropertyCollectionsEventData

A DiagnosticSource event payload class for events that have two unmapped property collections.

ValueConverterEventData

A DiagnosticSource event payload class for events that have a ValueConverter.

WarningsConfiguration

Represents configuration for which warnings should be thrown, logged, or ignored. by database providers or extensions. These options are set using WarningsConfigurationBuilder.

Instances of this class are designed to be immutable. To change an option, call one of the 'With...' methods to obtain a new instance with the option changed.

WarningsConfigurationBuilder

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.

Structs

InterceptionResult

Represents a result from an IInterceptor such as an 'IDbConnectionInterceptor' to allow suppression of the normal operation being intercepted.

A value of this type is passed to all interceptor methods that are called before the operation being intercepted is executed. Typically the interceptor should return the value passed in. However, creating a result with Suppress() causes the operation being intercepted to be suppressed; that is, the operation is not executed.

InterceptionResult<TResult>

Represents a result from an IInterceptor such as an 'IDbCommandInterceptor' to allow suppression of the normal operation being intercepted.

A value of this type is passed to all interceptor methods that are called before the operation being intercepted is executed. Typically the interceptor should return the value passed in. However, creating a result with SuppressWithResult(TResult) causes the operation being intercepted to be suppressed; that is, the operation is not executed. The value in the result is then used as a substitute return value for the operation that was suppressed.

Interfaces

ICollectionChangedEventData

An interface implemented by any EventData subclass that represents a change to either a skip collection navigation or a regular collection navigation.

IDbCommandInterceptor

Allows interception of commands sent to a relational database.

Command interceptors can be used to view, change, or suppress execution of the DbCommand, and to modify the result before it is returned to EF.

Consider inheriting from DbCommandInterceptor if not implementing all methods.

Use AddInterceptors(IInterceptor[]) to register application interceptors.

Extensions can also register interceptors in the internal service provider. If both injected and application interceptors are found, then the injected interceptors are run in the order that they are resolved from the service provider, and then the application interceptors are run last.

IDbConnectionInterceptor

Allows interception of operations on DbConnection.

Connection interceptors can be used to view, change, or suppress the operation on DbConnection, and to modify the result before it is returned to EF.

Consider inheriting from DbConnectionInterceptor if not implementing all methods.

Use AddInterceptors(IInterceptor[]) to register application interceptors.

Extensions can also register interceptors in the internal service provider. If both injected and application interceptors are found, then the injected interceptors are run in the order that they are resolved from the service provider, and then the application interceptors are run last.

IDbContextLogger

A simple logging interface for Entity Framework events. Used by LogTo(Action<String>, LogLevel, Nullable<DbContextLoggerOptions>)

IDbTransactionInterceptor

Allows interception of operations related to a DbTransaction.

Transaction interceptors can be used to view, change, or suppress operations on DbTransaction, and to modify the result before it is returned to EF.

Consider inheriting from DbTransactionInterceptor if not implementing all methods.

Use AddInterceptors(IInterceptor[]) to register application interceptors.

Extensions can also register interceptors in the internal service provider. If both injected and application interceptors are found, then the injected interceptors are run in the order that they are resolved from the service provider, and then the application interceptors are run last.

IDiagnosticsLogger

Combines ILogger and DiagnosticSource for use by all EF Core logging so that events can be sent to both ILogger for ASP.NET and DiagnosticSource for everything else.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

IDiagnosticsLogger<TLoggerCategory>

Combines ILogger and DiagnosticSource for use by all EF Core logging so that events can be sent to both ILogger for ASP.NET and DiagnosticSource for everything else.

Also intercepts messages such that warnings can be either logged or thrown, and such that a decision as to whether to log sensitive data or not can be made.

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

IErrorEventData

An interface implemented by any EventData subclass that represents an error event with an Exception.

IInterceptor

The base interface for all Entity Framework interceptors.

Interceptors can be used to view, change, or suppress operations taken by Entity Framework. See the specific implementations of this interface for details. For example, 'IDbCommandInterceptor'.

Use AddInterceptors(IInterceptor[]) to register application interceptors.

Extensions can also register multiple IInterceptors in the internal service provider. If both injected and application interceptors are found, then the injected interceptors are run in the order that they are resolved from the service provider, and then the application interceptors are run in the order that they were added to the context.

IInterceptorAggregator

A service to resolve a single IInterceptor /> from all those registered on the DbContext or in the internal service provider.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

Instances should be registered on the internal service provider as multiple IInterceptorAggregator interfaces.

IInterceptors

A service that resolves a single IInterceptor from all those registered on the DbContext or in the internal service provider.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is ServiceLifetime. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

ILoggingOptions

Options set at the IServiceProvider singleton level to control how messages are logged and/or thrown in exceptions.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

INavigationBaseEventData

A common interface for event payload classes that have an INavigationBase.

ISaveChangesInterceptor

Allows interception of the DbContext.SaveChanges and DbContext.SaveChangesAync methods.

Command interceptors can be used to view, change, or suppress execution of the SaveChanges call and modify the result before it is returned to EF.

Consider inheriting from SaveChangesInterceptor if not implementing all methods.

Use AddInterceptors(IInterceptor[]) to register application interceptors.

Extensions can also register interceptors in the internal service provider. If both injected and application interceptors are found, then the injected interceptors are run in the order that they are resolved from the service provider, and then the application interceptors are run last.

Enums

DbCommandMethod

Enum used by CommandEventData, an subclasses to indicate the method on DbCommand being used to execute the command.

DbContextLoggerOptions

Formatting options for use with Microsoft.EntityFrameworkCore.Diagnostics.Internal.FormattingDbContextLogger and LogTo(Action<String>, LogLevel, Nullable<DbContextLoggerOptions>).