diff --git a/src/EFCore/ChangeTracking/Internal/StateManager.cs b/src/EFCore/ChangeTracking/Internal/StateManager.cs index faffa5c53cc..13a5431e9f0 100644 --- a/src/EFCore/ChangeTracking/Internal/StateManager.cs +++ b/src/EFCore/ChangeTracking/Internal/StateManager.cs @@ -1114,6 +1114,8 @@ protected virtual async Task SaveChangesAsync( { using (_concurrencyDetector.EnterCriticalSection()) { + EntityFrameworkEventSource.Log.SavingChanges(); + return await _database.SaveChangesAsync(entriesToSave, cancellationToken) .ConfigureAwait(false); } diff --git a/src/EFCore/DbContext.cs b/src/EFCore/DbContext.cs index 31efe9f5c3e..8f0d0ad35d5 100644 --- a/src/EFCore/DbContext.cs +++ b/src/EFCore/DbContext.cs @@ -112,6 +112,8 @@ public DbContext([NotNull] DbContextOptions options) ServiceProviderCache.Instance.GetOrAdd(options, providerRequired: false) .GetRequiredService() .InitializeSets(this); + + EntityFrameworkEventSource.Log.DbContextInitializing(); } /// @@ -347,8 +349,6 @@ private IServiceProvider InternalServiceProvider { _initializing = true; - EntityFrameworkEventSource.Log.DbContextInitializing(); - var optionsBuilder = new DbContextOptionsBuilder(_options); OnConfiguring(optionsBuilder); @@ -642,6 +642,8 @@ public virtual async Task SaveChangesAsync( } catch (DbUpdateConcurrencyException exception) { + EntityFrameworkEventSource.Log.OptimisticConcurrencyFailure(); + await DbContextDependencies.UpdateLogger.OptimisticConcurrencyExceptionAsync(this, exception, cancellationToken) .ConfigureAwait(false); diff --git a/src/EFCore/Storage/ExecutionStrategy.cs b/src/EFCore/Storage/ExecutionStrategy.cs index 16240197fa0..4f947f62023 100644 --- a/src/EFCore/Storage/ExecutionStrategy.cs +++ b/src/EFCore/Storage/ExecutionStrategy.cs @@ -273,6 +273,9 @@ private async Task ExecuteImplementationAsync( catch (Exception ex) { Suspended = false; + + EntityFrameworkEventSource.Log.ExecutionStrategyOperationFailure(); + if (verifySucceeded != null && CallOnWrappedException(ex, ShouldVerifySuccessOn)) {