From 7e949660bae392f55f5ca83f3ee3ba144b9ea20f Mon Sep 17 00:00:00 2001 From: Andriy Svyryd Date: Wed, 5 Jan 2022 13:03:23 -0800 Subject: [PATCH] Fix spelling in LoggingDefinitions.LogSaveChangesCanceled. Add a sugar constructor to NonRetryingExecutionStrategy. --- src/EFCore/Diagnostics/LoggingDefinitions.cs | 2 +- src/EFCore/Properties/CoreStrings.Designer.cs | 4 +- src/EFCore/Properties/CoreStrings.resx | 58 +++++++++---------- .../Storage/NonRetryingExecutionStrategy.cs | 9 +++ 4 files changed, 41 insertions(+), 32 deletions(-) diff --git a/src/EFCore/Diagnostics/LoggingDefinitions.cs b/src/EFCore/Diagnostics/LoggingDefinitions.cs index c712851a7b2..c403eb9a3d6 100644 --- a/src/EFCore/Diagnostics/LoggingDefinitions.cs +++ b/src/EFCore/Diagnostics/LoggingDefinitions.cs @@ -167,7 +167,7 @@ public abstract class LoggingDefinitions /// doing so can result in application failures when updating to a new Entity Framework Core release. /// [EntityFrameworkInternal] - public EventDefinitionBase? LogSaveChangedCanceled; + public EventDefinitionBase? LogSaveChangesCanceled; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to diff --git a/src/EFCore/Properties/CoreStrings.Designer.cs b/src/EFCore/Properties/CoreStrings.Designer.cs index 7badcc3dd29..ecebccc29e4 100644 --- a/src/EFCore/Properties/CoreStrings.Designer.cs +++ b/src/EFCore/Properties/CoreStrings.Designer.cs @@ -4189,11 +4189,11 @@ public static EventDefinition LogRowLimitingOperationWithoutOrderBy(IDiagnostics /// public static EventDefinition LogSaveChangesCanceled(IDiagnosticsLogger logger) { - var definition = ((LoggingDefinitions)logger.Definitions).LogSaveChangedCanceled; + var definition = ((LoggingDefinitions)logger.Definitions).LogSaveChangesCanceled; if (definition == null) { definition = NonCapturingLazyInitializer.EnsureInitialized( - ref ((LoggingDefinitions)logger.Definitions).LogSaveChangedCanceled, + ref ((LoggingDefinitions)logger.Definitions).LogSaveChangesCanceled, logger, static logger => new EventDefinition( logger.Options, diff --git a/src/EFCore/Properties/CoreStrings.resx b/src/EFCore/Properties/CoreStrings.resx index 155b1bb1ce6..e2872bc118d 100644 --- a/src/EFCore/Properties/CoreStrings.resx +++ b/src/EFCore/Properties/CoreStrings.resx @@ -1,17 +1,17 @@  - @@ -1278,7 +1278,7 @@ The maximum number of retries ({retryLimit}) was exceeded while executing database operations with '{strategy}'. See the inner exception for the most recent failure. - The requested configuration is not stored in the read-optimized model, please use 'DbContext.GetService&lt;IDesignTimeModel&gt;().Model'. + The requested configuration is not stored in the read-optimized model, please use 'DbContext.GetService<IDesignTimeModel>().Model'. While registering a runtime parameter, the lambda expression must have only one parameter which must be same as 'QueryCompilationContext.QueryContextParameter' expression. @@ -1472,4 +1472,4 @@ Cannot start tracking the entry for entity type '{entityType}' because it was created by a different StateManager instance. - + \ No newline at end of file diff --git a/src/EFCore/Storage/NonRetryingExecutionStrategy.cs b/src/EFCore/Storage/NonRetryingExecutionStrategy.cs index 3cc9501d0cc..13c1bc8aa28 100644 --- a/src/EFCore/Storage/NonRetryingExecutionStrategy.cs +++ b/src/EFCore/Storage/NonRetryingExecutionStrategy.cs @@ -29,6 +29,15 @@ public NonRetryingExecutionStrategy(ExecutionStrategyDependencies dependencies) Dependencies = dependencies; } + /// + /// Constructs a new with the given context. + /// + /// The context on which the operations will be invoked. + public NonRetryingExecutionStrategy(DbContext context) + { + Dependencies = context.GetService(); + } + private ExecutionStrategyDependencies Dependencies { get; } ///