diff --git a/src/EFCore.Design/Migrations/Design/MigrationsScaffolder.cs b/src/EFCore.Design/Migrations/Design/MigrationsScaffolder.cs index d272cb07fa5..ca2dfb88ef1 100644 --- a/src/EFCore.Design/Migrations/Design/MigrationsScaffolder.cs +++ b/src/EFCore.Design/Migrations/Design/MigrationsScaffolder.cs @@ -35,7 +35,7 @@ public MigrationsScaffolder([NotNull] MigrationsScaffolderDependencies dependenc { Check.NotNull(dependencies, nameof(dependencies)); - _contextType = dependencies.CurrentDbContext.Context.GetType(); + _contextType = dependencies.CurrentContext.Context.GetType(); _activeProvider = dependencies.DatabaseProvider.Name; Dependencies = dependencies; } diff --git a/src/EFCore.Design/Migrations/Design/MigrationsScaffolderDependencies.cs b/src/EFCore.Design/Migrations/Design/MigrationsScaffolderDependencies.cs index ee43f53160e..4163016635a 100644 --- a/src/EFCore.Design/Migrations/Design/MigrationsScaffolderDependencies.cs +++ b/src/EFCore.Design/Migrations/Design/MigrationsScaffolderDependencies.cs @@ -49,7 +49,7 @@ public sealed class MigrationsScaffolderDependencies /// doing so can result in application failures when updating to a new Entity Framework Core release. /// /// - /// The current DbContext. + /// The current DbContext. /// The model. /// The migrations assembly. /// The migrations model differ. @@ -62,7 +62,7 @@ public sealed class MigrationsScaffolderDependencies /// The migrator. [EntityFrameworkInternal] public MigrationsScaffolderDependencies( - [NotNull] ICurrentDbContext currentDbContext, + [NotNull] ICurrentDbContext currentContext, [NotNull] IModel model, [NotNull] IMigrationsAssembly migrationsAssembly, [NotNull] IMigrationsModelDiffer migrationsModelDiffer, @@ -74,7 +74,7 @@ public MigrationsScaffolderDependencies( [NotNull] ISnapshotModelProcessor snapshotModelProcessor, [NotNull] IMigrator migrator) { - Check.NotNull(currentDbContext, nameof(currentDbContext)); + Check.NotNull(currentContext, nameof(currentContext)); Check.NotNull(model, nameof(model)); Check.NotNull(migrationsAssembly, nameof(migrationsAssembly)); Check.NotNull(migrationsModelDiffer, nameof(migrationsModelDiffer)); @@ -86,7 +86,7 @@ public MigrationsScaffolderDependencies( Check.NotNull(snapshotModelProcessor, nameof(snapshotModelProcessor)); Check.NotNull(migrator, nameof(migrator)); - CurrentDbContext = currentDbContext; + CurrentContext = currentContext; Model = model; MigrationsAssembly = migrationsAssembly; MigrationsModelDiffer = migrationsModelDiffer; @@ -102,7 +102,7 @@ public MigrationsScaffolderDependencies( /// /// The current DbContext. /// - public ICurrentDbContext CurrentDbContext { get; } + public ICurrentDbContext CurrentContext { get; } /// /// The model. @@ -157,11 +157,11 @@ public MigrationsScaffolderDependencies( /// /// Clones this dependency parameter object with one service replaced. /// - /// A replacement for the current dependency of this type. + /// A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. - public MigrationsScaffolderDependencies With([NotNull] ICurrentDbContext currentDbContext) + public MigrationsScaffolderDependencies With([NotNull] ICurrentDbContext currentContext) => new MigrationsScaffolderDependencies( - currentDbContext, + currentContext, Model, MigrationsAssembly, MigrationsModelDiffer, @@ -180,7 +180,7 @@ public MigrationsScaffolderDependencies With([NotNull] ICurrentDbContext current /// A new parameter object with the given service replaced. public MigrationsScaffolderDependencies With([NotNull] IModel model) => new MigrationsScaffolderDependencies( - CurrentDbContext, + CurrentContext, model, MigrationsAssembly, MigrationsModelDiffer, @@ -199,7 +199,7 @@ public MigrationsScaffolderDependencies With([NotNull] IModel model) /// A new parameter object with the given service replaced. public MigrationsScaffolderDependencies With([NotNull] IMigrationsAssembly migrationsAssembly) => new MigrationsScaffolderDependencies( - CurrentDbContext, + CurrentContext, Model, migrationsAssembly, MigrationsModelDiffer, @@ -218,7 +218,7 @@ public MigrationsScaffolderDependencies With([NotNull] IMigrationsAssembly migra /// A new parameter object with the given service replaced. public MigrationsScaffolderDependencies With([NotNull] IMigrationsModelDiffer migrationsModelDiffer) => new MigrationsScaffolderDependencies( - CurrentDbContext, + CurrentContext, Model, MigrationsAssembly, migrationsModelDiffer, @@ -237,7 +237,7 @@ public MigrationsScaffolderDependencies With([NotNull] IMigrationsModelDiffer mi /// A new parameter object with the given service replaced. public MigrationsScaffolderDependencies With([NotNull] IMigrationsIdGenerator migrationsIdGenerator) => new MigrationsScaffolderDependencies( - CurrentDbContext, + CurrentContext, Model, MigrationsAssembly, MigrationsModelDiffer, @@ -256,7 +256,7 @@ public MigrationsScaffolderDependencies With([NotNull] IMigrationsIdGenerator mi /// A new parameter object with the given service replaced. public MigrationsScaffolderDependencies With([NotNull] IMigrationsCodeGeneratorSelector migrationsCodeGeneratorSelector) => new MigrationsScaffolderDependencies( - CurrentDbContext, + CurrentContext, Model, MigrationsAssembly, MigrationsModelDiffer, @@ -275,7 +275,7 @@ public MigrationsScaffolderDependencies With([NotNull] IMigrationsCodeGeneratorS /// A new parameter object with the given service replaced. public MigrationsScaffolderDependencies With([NotNull] IHistoryRepository historyRepository) => new MigrationsScaffolderDependencies( - CurrentDbContext, + CurrentContext, Model, MigrationsAssembly, MigrationsModelDiffer, @@ -294,7 +294,7 @@ public MigrationsScaffolderDependencies With([NotNull] IHistoryRepository histor /// A new parameter object with the given service replaced. public MigrationsScaffolderDependencies With([NotNull] IOperationReporter operationReporter) => new MigrationsScaffolderDependencies( - CurrentDbContext, + CurrentContext, Model, MigrationsAssembly, MigrationsModelDiffer, @@ -313,7 +313,7 @@ public MigrationsScaffolderDependencies With([NotNull] IOperationReporter operat /// A new parameter object with the given service replaced. public MigrationsScaffolderDependencies With([NotNull] IDatabaseProvider databaseProvider) => new MigrationsScaffolderDependencies( - CurrentDbContext, + CurrentContext, Model, MigrationsAssembly, MigrationsModelDiffer, @@ -332,7 +332,7 @@ public MigrationsScaffolderDependencies With([NotNull] IDatabaseProvider databas /// A new parameter object with the given service replaced. public MigrationsScaffolderDependencies With([NotNull] ISnapshotModelProcessor snapshotModelProcessor) => new MigrationsScaffolderDependencies( - CurrentDbContext, + CurrentContext, Model, MigrationsAssembly, MigrationsModelDiffer, @@ -351,7 +351,7 @@ public MigrationsScaffolderDependencies With([NotNull] ISnapshotModelProcessor s /// A new parameter object with the given service replaced. public MigrationsScaffolderDependencies With([NotNull] IMigrator migrator) => new MigrationsScaffolderDependencies( - CurrentDbContext, + CurrentContext, Model, MigrationsAssembly, MigrationsModelDiffer, diff --git a/src/EFCore.Relational/Diagnostics/Internal/DbCommandInterceptorResolver.cs b/src/EFCore.Relational/Diagnostics/Internal/DbCommandInterceptorAggregator.cs similarity index 98% rename from src/EFCore.Relational/Diagnostics/Internal/DbCommandInterceptorResolver.cs rename to src/EFCore.Relational/Diagnostics/Internal/DbCommandInterceptorAggregator.cs index e5dad592494..6550534d188 100644 --- a/src/EFCore.Relational/Diagnostics/Internal/DbCommandInterceptorResolver.cs +++ b/src/EFCore.Relational/Diagnostics/Internal/DbCommandInterceptorAggregator.cs @@ -16,7 +16,7 @@ namespace Microsoft.EntityFrameworkCore.Diagnostics.Internal /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public class DbCommandInterceptorResolver : InterceptorResolver + public class DbCommandInterceptorAggregator : InterceptorAggregator { /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to diff --git a/src/EFCore.Relational/Diagnostics/Internal/DbConnectionInterceptorResolver.cs b/src/EFCore.Relational/Diagnostics/Internal/DbConnectionInterceptorAggregator.cs similarity index 98% rename from src/EFCore.Relational/Diagnostics/Internal/DbConnectionInterceptorResolver.cs rename to src/EFCore.Relational/Diagnostics/Internal/DbConnectionInterceptorAggregator.cs index 15bc2ef5848..09cc0f2a7cd 100644 --- a/src/EFCore.Relational/Diagnostics/Internal/DbConnectionInterceptorResolver.cs +++ b/src/EFCore.Relational/Diagnostics/Internal/DbConnectionInterceptorAggregator.cs @@ -16,7 +16,7 @@ namespace Microsoft.EntityFrameworkCore.Diagnostics.Internal /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public class DbConnectionInterceptorResolver : InterceptorResolver + public class DbConnectionInterceptorAggregator : InterceptorAggregator { /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to diff --git a/src/EFCore.Relational/Diagnostics/Internal/DbTransactionInterceptorResolver.cs b/src/EFCore.Relational/Diagnostics/Internal/DbTransactionInterceptorAggregator.cs similarity index 98% rename from src/EFCore.Relational/Diagnostics/Internal/DbTransactionInterceptorResolver.cs rename to src/EFCore.Relational/Diagnostics/Internal/DbTransactionInterceptorAggregator.cs index 4195901bf78..9323c2c0f52 100644 --- a/src/EFCore.Relational/Diagnostics/Internal/DbTransactionInterceptorResolver.cs +++ b/src/EFCore.Relational/Diagnostics/Internal/DbTransactionInterceptorAggregator.cs @@ -16,7 +16,7 @@ namespace Microsoft.EntityFrameworkCore.Diagnostics.Internal /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public class DbTransactionInterceptorResolver : InterceptorResolver + public class DbTransactionInterceptorAggregator : InterceptorAggregator { /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to diff --git a/src/EFCore.Relational/Diagnostics/RelationalLoggerExtensions.cs b/src/EFCore.Relational/Diagnostics/RelationalLoggerExtensions.cs index 59a74cafbd7..7b7113d9063 100644 --- a/src/EFCore.Relational/Diagnostics/RelationalLoggerExtensions.cs +++ b/src/EFCore.Relational/Diagnostics/RelationalLoggerExtensions.cs @@ -61,7 +61,7 @@ public static InterceptionResult CommandReaderExecuting( LogCommandExecuting(diagnostics, command, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -110,7 +110,7 @@ public static InterceptionResult CommandScalarExecuting( LogCommandExecuting(diagnostics, command, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -159,7 +159,7 @@ public static InterceptionResult CommandNonQueryExecuting( LogCommandExecuting(diagnostics, command, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -210,7 +210,7 @@ public static Task> CommandReaderExecutingAsync LogCommandExecuting(diagnostics, command, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -261,7 +261,7 @@ public static Task> CommandScalarExecutingAsync( LogCommandExecuting(diagnostics, command, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -312,7 +312,7 @@ public static Task> CommandNonQueryExecutingAsync( LogCommandExecuting(diagnostics, command, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -436,7 +436,7 @@ public static DbDataReader CommandReaderExecuted( LogCommandExecuted(diagnostics, command, duration, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -491,7 +491,7 @@ public static object CommandScalarExecuted( LogCommandExecuted(diagnostics, command, duration, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -546,7 +546,7 @@ public static int CommandNonQueryExecuted( LogCommandExecuted(diagnostics, command, duration, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -603,7 +603,7 @@ public static Task CommandReaderExecutedAsync( LogCommandExecuted(diagnostics, command, duration, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -660,7 +660,7 @@ public static Task CommandScalarExecutedAsync( LogCommandExecuted(diagnostics, command, duration, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -717,7 +717,7 @@ public static Task CommandNonQueryExecutedAsync( LogCommandExecuted(diagnostics, command, duration, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -845,7 +845,7 @@ public static void CommandError( LogCommandError(diagnostics, command, duration, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -920,7 +920,7 @@ public static Task CommandErrorAsync( LogCommandError(diagnostics, command, duration, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1016,7 +1016,7 @@ public static InterceptionResult ConnectionOpening( LogConnectionOpening(diagnostics, connection, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1057,7 +1057,7 @@ public static Task ConnectionOpeningAsync( LogConnectionOpening(diagnostics, connection, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1147,7 +1147,7 @@ public static void ConnectionOpened( LogConnectionOpened(diagnostics, connection, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1186,7 +1186,7 @@ public static Task ConnectionOpenedAsync( LogConnectionOpened(diagnostics, connection, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1277,7 +1277,7 @@ public static InterceptionResult ConnectionClosing( LogConnectionClosing(diagnostics, connection, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1316,7 +1316,7 @@ public static Task ConnectionClosingAsync( LogConnectionClosing(diagnostics, connection, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1405,7 +1405,7 @@ public static void ConnectionClosed( LogConnectionClosed(diagnostics, connection, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1442,7 +1442,7 @@ public static Task ConnectionClosedAsync( LogConnectionClosed(diagnostics, connection, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1540,7 +1540,7 @@ public static void ConnectionError( LogConnectionError(diagnostics, connection, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1586,7 +1586,7 @@ public static Task ConnectionErrorAsync( LogConnectionError(diagnostics, connection, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1684,7 +1684,7 @@ public static InterceptionResult TransactionStarting( LogTransactionStarting(diagnostics, isolationLevel, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1731,7 +1731,7 @@ public static Task> TransactionStartingAsync( LogTransactionStarting(diagnostics, isolationLevel, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1829,7 +1829,7 @@ public static DbTransaction TransactionStarted( LogTransactionStarted(diagnostics, transaction, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1879,7 +1879,7 @@ public static Task TransactionStartedAsync( LogTransactionStarted(diagnostics, transaction, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -1977,7 +1977,7 @@ public static DbTransaction TransactionUsed( LogTransactionUsed(diagnostics, transaction, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -2024,7 +2024,7 @@ public static Task TransactionUsedAsync( LogTransactionUsed(diagnostics, transaction, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -2120,7 +2120,7 @@ public static InterceptionResult TransactionCommitting( LogTransactionCommitting(diagnostics, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -2167,7 +2167,7 @@ public static Task TransactionCommittingAsync( LogTransactionCommitting(diagnostics, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -2252,7 +2252,7 @@ public static void TransactionCommitted( LogTransactionCommitted(diagnostics, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -2297,7 +2297,7 @@ public static Task TransactionCommittedAsync( LogTransactionCommitted(diagnostics, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -2385,7 +2385,7 @@ public static void TransactionRolledBack( LogTransactionRolledBack(diagnostics, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -2430,7 +2430,7 @@ public static Task TransactionRolledBackAsync( LogTransactionRolledBack(diagnostics, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -2517,7 +2517,7 @@ public static InterceptionResult TransactionRollingBack( LogTransactionRollingBack(diagnostics, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -2564,7 +2564,7 @@ public static Task TransactionRollingBackAsync( LogTransactionRollingBack(diagnostics, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -2692,7 +2692,7 @@ public static void TransactionError( LogTransactionError(diagnostics, exception, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -2743,7 +2743,7 @@ public static Task TransactionErrorAsync( LogTransactionError(diagnostics, exception, definition); var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) @@ -2967,7 +2967,7 @@ public static InterceptionResult DataReaderDisposing( } var diagnosticSourceEnabled = diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name); - var interceptor = diagnostics.Interceptors?.Resolve(); + var interceptor = diagnostics.Interceptors?.Aggregate(); if (interceptor != null || diagnosticSourceEnabled) diff --git a/src/EFCore.Relational/Infrastructure/EntityFrameworkRelationalServicesBuilder.cs b/src/EFCore.Relational/Infrastructure/EntityFrameworkRelationalServicesBuilder.cs index d998917eff4..ae73bf92f01 100644 --- a/src/EFCore.Relational/Infrastructure/EntityFrameworkRelationalServicesBuilder.cs +++ b/src/EFCore.Relational/Infrastructure/EntityFrameworkRelationalServicesBuilder.cs @@ -81,7 +81,7 @@ public static readonly IDictionary RelationalServi { typeof(IRelationalDatabaseCreator), new ServiceCharacteristics(ServiceLifetime.Scoped) }, { typeof(IHistoryRepository), new ServiceCharacteristics(ServiceLifetime.Scoped) }, { typeof(INamedConnectionStringResolver), new ServiceCharacteristics(ServiceLifetime.Scoped) }, - { typeof(IInterceptorResolver), new ServiceCharacteristics(ServiceLifetime.Scoped, multipleRegistrations: true) }, + { typeof(IInterceptorAggregator), new ServiceCharacteristics(ServiceLifetime.Scoped, multipleRegistrations: true) }, { typeof(IInterceptor), new ServiceCharacteristics(ServiceLifetime.Scoped, multipleRegistrations: true) }, { typeof(IRelationalTypeMappingSourcePlugin), new ServiceCharacteristics(ServiceLifetime.Singleton, multipleRegistrations: true) }, @@ -158,9 +158,9 @@ public override EntityFrameworkServicesBuilder TryAddCoreServices() TryAdd(); TryAdd(p => p.GetService()); TryAdd(); - TryAdd(); - TryAdd(); - TryAdd(); + TryAdd(); + TryAdd(); + TryAdd(); // New Query pipeline TryAdd(); diff --git a/src/EFCore.Relational/Metadata/Builders/DbFunctionParameterBuilder.cs b/src/EFCore.Relational/Metadata/Builders/DbFunctionParameterBuilder.cs index 3cc2fca3b12..a76daba7e0b 100644 --- a/src/EFCore.Relational/Metadata/Builders/DbFunctionParameterBuilder.cs +++ b/src/EFCore.Relational/Metadata/Builders/DbFunctionParameterBuilder.cs @@ -45,38 +45,6 @@ public DbFunctionParameterBuilder([NotNull] IMutableDbFunctionParameter paramete /// IConventionDbFunctionParameter IConventionDbFunctionParameterBuilder.Metadata => _parameter; - /// - /// Configures whether or not the function should propagate null values through to the function result. - /// - /// True to enable null-propagation; false to disable it. - /// The same builder instance so that further configuration calls can be chained. - public virtual DbFunctionParameterBuilder HasNullPropagation(bool supportsNullPropagation = true) - { - _parameter.SupportsNullPropagation = supportsNullPropagation; - - return this; - } - - /// - IConventionDbFunctionParameterBuilder IConventionDbFunctionParameterBuilder.HasNullPropagation( - bool supportsNullPropagation, bool fromDataAnnotation) - { - if (((IConventionDbFunctionParameterBuilder)this).CanSetSupportsNullPropagation(supportsNullPropagation, fromDataAnnotation)) - { - ((IConventionDbFunctionParameter)_parameter).SetSupportsNullPropagation(supportsNullPropagation, fromDataAnnotation); - return this; - } - - return null; - } - - /// - bool IConventionDbFunctionParameterBuilder.CanSetSupportsNullPropagation(bool supportsNullPropagation, bool fromDataAnnotation) - { - return Overrides(fromDataAnnotation, _parameter.GetSupportsNullPropagationConfigurationSource()) - || _parameter.SupportsNullPropagation == supportsNullPropagation; - } - /// /// Sets the store type of the function parameter in the database. /// diff --git a/src/EFCore.Relational/Metadata/Builders/IConventionDbFunctionParameterBuilder.cs b/src/EFCore.Relational/Metadata/Builders/IConventionDbFunctionParameterBuilder.cs index 7c5868c4855..dd6681f15b2 100644 --- a/src/EFCore.Relational/Metadata/Builders/IConventionDbFunctionParameterBuilder.cs +++ b/src/EFCore.Relational/Metadata/Builders/IConventionDbFunctionParameterBuilder.cs @@ -16,23 +16,6 @@ public interface IConventionDbFunctionParameterBuilder /// IConventionDbFunctionParameter Metadata { get; } - /// - /// Configures whether or not the function should propagation null values through to the function result. - /// - /// True to enable null-propagation; false to disable it. - /// Indicates whether the configuration was specified using a data annotation. - /// The same builder instance if the configuration was applied; null otherwise. - IConventionDbFunctionParameterBuilder HasNullPropagation(bool supportsNullPropagation, bool fromDataAnnotation = false); - - /// - /// Returns a value indicating whether the null-propagation can be changed for this property - /// from the current configuration source. - /// - /// True to enable null-propagation; false to disable it. - /// Indicates whether the configuration was specified using a data annotation. - /// True if the null-propagation can be changed for this property. - bool CanSetSupportsNullPropagation(bool supportsNullPropagation, bool fromDataAnnotation = false); - /// /// Sets the store type of the function parameter in the database. /// diff --git a/src/EFCore.Relational/Metadata/IConventionDbFunctionParameter.cs b/src/EFCore.Relational/Metadata/IConventionDbFunctionParameter.cs index 9ff69f1757d..0ffeda84323 100644 --- a/src/EFCore.Relational/Metadata/IConventionDbFunctionParameter.cs +++ b/src/EFCore.Relational/Metadata/IConventionDbFunctionParameter.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using JetBrains.Annotations; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage; namespace Microsoft.EntityFrameworkCore.Metadata @@ -15,7 +14,7 @@ public interface IConventionDbFunctionParameter : IDbFunctionParameter /// /// The to which this parameter belongs. /// - new IConventionDbFunction Parent { get; } + new IConventionDbFunction Function { get; } /// /// The for building a by-convention function parameter. @@ -47,18 +46,5 @@ public interface IConventionDbFunctionParameter : IDbFunctionParameter /// /// The configuration source for . ConfigurationSource? GetTypeMappingConfigurationSource(); - - /// - /// Sets if the parameter propagates null in the database. - /// - /// The supports null propagation value. - /// Indicates whether the configuration was specified using a data annotation. - void SetSupportsNullPropagation(bool supportsNullPropagation, bool fromDataAnnotation = false); - - /// - /// Returns the configuration source for . - /// - /// The configuration source for . - ConfigurationSource? GetSupportsNullPropagationConfigurationSource(); } } diff --git a/src/EFCore.Relational/Metadata/IDbFunctionParameter.cs b/src/EFCore.Relational/Metadata/IDbFunctionParameter.cs index 37d77a71bca..eedf6bce319 100644 --- a/src/EFCore.Relational/Metadata/IDbFunctionParameter.cs +++ b/src/EFCore.Relational/Metadata/IDbFunctionParameter.cs @@ -14,7 +14,7 @@ public interface IDbFunctionParameter /// /// The to which this parameter belongs. /// - IDbFunction Parent { get; } + IDbFunction Function { get; } /// /// The parameter name. @@ -26,11 +26,6 @@ public interface IDbFunctionParameter /// Type ClrType { get; } - /// - /// If true, then a null in this parameter will be propagated to the result. - /// - bool SupportsNullPropagation { get; } - /// /// The store (database) type of this parameter. /// diff --git a/src/EFCore.Relational/Metadata/IMutableDbFunctionParameter.cs b/src/EFCore.Relational/Metadata/IMutableDbFunctionParameter.cs index 68645901ec2..24be4f0c517 100644 --- a/src/EFCore.Relational/Metadata/IMutableDbFunctionParameter.cs +++ b/src/EFCore.Relational/Metadata/IMutableDbFunctionParameter.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore.Storage; @@ -15,12 +14,7 @@ public interface IMutableDbFunctionParameter : IDbFunctionParameter /// /// The to which this parameter belongs. /// - new IMutableDbFunction Parent { get; } - - /// - /// If true, then a null in this parameter will be propagated to the result. - /// - new bool SupportsNullPropagation { get; set; } + new IMutableDbFunction Function { get; } /// /// The store (database) type of this parameter. diff --git a/src/EFCore.Relational/Metadata/Internal/DbFunctionParameter.cs b/src/EFCore.Relational/Metadata/Internal/DbFunctionParameter.cs index b3b4ce8c459..482e0066c73 100644 --- a/src/EFCore.Relational/Metadata/Internal/DbFunctionParameter.cs +++ b/src/EFCore.Relational/Metadata/Internal/DbFunctionParameter.cs @@ -17,14 +17,12 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Internal /// public class DbFunctionParameter : IMutableDbFunctionParameter, IConventionDbFunctionParameter { - private readonly IMutableDbFunction _parent; + private readonly IMutableDbFunction _function; private readonly string _name; private readonly Type _clrType; - private bool _supportsNullPropagation; private string _storeType; private RelationalTypeMapping _typeMapping; - private ConfigurationSource? _supportsNullPropagationConfigurationSource; private ConfigurationSource? _storeTypeConfigurationSource; private ConfigurationSource? _typeMappingConfigurationSource; @@ -34,14 +32,14 @@ public class DbFunctionParameter : IMutableDbFunctionParameter, IConventionDbFun /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public DbFunctionParameter([NotNull] IMutableDbFunction parent, [NotNull] string name, [NotNull] Type clrType) + public DbFunctionParameter([NotNull] IMutableDbFunction function, [NotNull] string name, [NotNull] Type clrType) { Check.NotEmpty(name, nameof(name)); Check.NotNull(clrType, nameof(clrType)); - Check.NotNull(parent, nameof(parent)); + Check.NotNull(function, nameof(function)); _name = name; - _parent = parent; + _function = function; _clrType = clrType; } @@ -53,42 +51,6 @@ public DbFunctionParameter([NotNull] IMutableDbFunction parent, [NotNull] string /// public virtual IConventionDbFunctionParameterBuilder Builder => new DbFunctionParameterBuilder(this); - /// - /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to - /// the same compatibility standards as public APIs. It may be changed or removed without notice in - /// any release. You should only use it directly in your code with extreme caution and knowing that - /// doing so can result in application failures when updating to a new Entity Framework Core release. - /// - public virtual bool SupportsNullPropagation - { - get => _supportsNullPropagation; - set => SetSupportsNullPropagation(value, ConfigurationSource.Explicit); - } - - /// - /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to - /// the same compatibility standards as public APIs. It may be changed or removed without notice in - /// any release. You should only use it directly in your code with extreme caution and knowing that - /// doing so can result in application failures when updating to a new Entity Framework Core release. - /// - public virtual void SetSupportsNullPropagation(bool supportsNullPropagation, ConfigurationSource configurationSource) - { - _supportsNullPropagation = supportsNullPropagation; - - UpdateSupportsNullPropagationConfigurationSource(configurationSource); - } - - private void UpdateSupportsNullPropagationConfigurationSource(ConfigurationSource configurationSource) - => _supportsNullPropagationConfigurationSource = configurationSource.Max(_supportsNullPropagationConfigurationSource); - - /// - /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to - /// the same compatibility standards as public APIs. It may be changed or removed without notice in - /// any release. You should only use it directly in your code with extreme caution and knowing that - /// doing so can result in application failures when updating to a new Entity Framework Core release. - /// - public virtual ConfigurationSource? GetSupportsNullPropagationConfigurationSource() => _supportsNullPropagationConfigurationSource; - /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in @@ -173,7 +135,7 @@ private void UpdateTypeMappingConfigurationSource(ConfigurationSource configurat /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - IConventionDbFunction IConventionDbFunctionParameter.Parent => (IConventionDbFunction)_parent; + IConventionDbFunction IConventionDbFunctionParameter.Function => (IConventionDbFunction)_function; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -181,7 +143,7 @@ private void UpdateTypeMappingConfigurationSource(ConfigurationSource configurat /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - IDbFunction IDbFunctionParameter.Parent => _parent; + IDbFunction IDbFunctionParameter.Function => _function; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -189,7 +151,7 @@ private void UpdateTypeMappingConfigurationSource(ConfigurationSource configurat /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - IMutableDbFunction IMutableDbFunctionParameter.Parent => _parent; + IMutableDbFunction IMutableDbFunctionParameter.Function => _function; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -216,17 +178,6 @@ private void UpdateTypeMappingConfigurationSource(ConfigurationSource configurat void IConventionDbFunctionParameter.SetStoreType(string storeType, bool fromDataAnnotation) => SetStoreType(storeType, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention); - /// - /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to - /// the same compatibility standards as public APIs. It may be changed or removed without notice in - /// any release. You should only use it directly in your code with extreme caution and knowing that - /// doing so can result in application failures when updating to a new Entity Framework Core release. - /// - void IConventionDbFunctionParameter.SetSupportsNullPropagation(bool supportsNullPropagation, bool fromDataAnnotation) - => SetSupportsNullPropagation( - supportsNullPropagation, - fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention); - /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in diff --git a/src/EFCore.Relational/Migrations/HistoryRepository.cs b/src/EFCore.Relational/Migrations/HistoryRepository.cs index 284e531e646..6904ef1b6da 100644 --- a/src/EFCore.Relational/Migrations/HistoryRepository.cs +++ b/src/EFCore.Relational/Migrations/HistoryRepository.cs @@ -135,7 +135,7 @@ public virtual bool Exists() new RelationalCommandParameterObject( Dependencies.Connection, null, - Dependencies.CurrentDbContext.Context, + Dependencies.CurrentContext.Context, Dependencies.CommandLogger))); /// @@ -153,7 +153,7 @@ await Dependencies.RawSqlCommandBuilder.Build(ExistsSql).ExecuteScalarAsync( new RelationalCommandParameterObject( Dependencies.Connection, null, - Dependencies.CurrentDbContext.Context, + Dependencies.CurrentContext.Context, Dependencies.CommandLogger), cancellationToken)); @@ -217,7 +217,7 @@ public virtual IReadOnlyList GetAppliedMigrations() new RelationalCommandParameterObject( Dependencies.Connection, null, - Dependencies.CurrentDbContext.Context, + Dependencies.CurrentContext.Context, Dependencies.CommandLogger))) { while (reader.Read()) @@ -251,7 +251,7 @@ public virtual async Task> GetAppliedMigrationsAsync( new RelationalCommandParameterObject( Dependencies.Connection, null, - Dependencies.CurrentDbContext.Context, + Dependencies.CurrentContext.Context, Dependencies.CommandLogger), cancellationToken)) { diff --git a/src/EFCore.Relational/Migrations/HistoryRepositoryDependencies.cs b/src/EFCore.Relational/Migrations/HistoryRepositoryDependencies.cs index b484ff5e9f6..7b697c34384 100644 --- a/src/EFCore.Relational/Migrations/HistoryRepositoryDependencies.cs +++ b/src/EFCore.Relational/Migrations/HistoryRepositoryDependencies.cs @@ -72,7 +72,7 @@ public sealed class HistoryRepositoryDependencies /// Helpers for generating update SQL. /// The convention set to use when creating the model. /// The type mapper. - /// Contains the currently in use. + /// Contains the currently in use. /// The logger for model building events. /// The command logger. [EntityFrameworkInternal] @@ -86,7 +86,7 @@ public HistoryRepositoryDependencies( [NotNull] ISqlGenerationHelper sqlGenerationHelper, [NotNull] IConventionSetBuilder conventionSetBuilder, [NotNull] IRelationalTypeMappingSource typeMappingSource, - [NotNull] ICurrentDbContext currentDbContext, + [NotNull] ICurrentDbContext currentContext, [NotNull] IDiagnosticsLogger modelLogger, [NotNull] IDiagnosticsLogger commandLogger) { @@ -99,7 +99,7 @@ public HistoryRepositoryDependencies( Check.NotNull(sqlGenerationHelper, nameof(sqlGenerationHelper)); Check.NotNull(conventionSetBuilder, nameof(conventionSetBuilder)); Check.NotNull(typeMappingSource, nameof(typeMappingSource)); - Check.NotNull(currentDbContext, nameof(currentDbContext)); + Check.NotNull(currentContext, nameof(currentContext)); Check.NotNull(modelLogger, nameof(modelLogger)); Check.NotNull(commandLogger, nameof(commandLogger)); @@ -112,7 +112,7 @@ public HistoryRepositoryDependencies( SqlGenerationHelper = sqlGenerationHelper; ConventionSetBuilder = conventionSetBuilder; TypeMappingSource = typeMappingSource; - CurrentDbContext = currentDbContext; + CurrentContext = currentContext; ModelLogger = modelLogger; CommandLogger = commandLogger; } @@ -165,7 +165,7 @@ public HistoryRepositoryDependencies( /// /// Contains the currently in use. /// - public ICurrentDbContext CurrentDbContext { get; } + public ICurrentDbContext CurrentContext { get; } /// /// The model logger @@ -193,7 +193,7 @@ public HistoryRepositoryDependencies With([NotNull] IRelationalDatabaseCreator d SqlGenerationHelper, ConventionSetBuilder, TypeMappingSource, - CurrentDbContext, + CurrentContext, ModelLogger, CommandLogger); @@ -213,7 +213,7 @@ public HistoryRepositoryDependencies With([NotNull] IRawSqlCommandBuilder rawSql SqlGenerationHelper, ConventionSetBuilder, TypeMappingSource, - CurrentDbContext, + CurrentContext, ModelLogger, CommandLogger); @@ -233,7 +233,7 @@ public HistoryRepositoryDependencies With([NotNull] IRelationalConnection connec SqlGenerationHelper, ConventionSetBuilder, TypeMappingSource, - CurrentDbContext, + CurrentContext, ModelLogger, CommandLogger); @@ -253,7 +253,7 @@ public HistoryRepositoryDependencies With([NotNull] IDbContextOptions options) SqlGenerationHelper, ConventionSetBuilder, TypeMappingSource, - CurrentDbContext, + CurrentContext, ModelLogger, CommandLogger); @@ -273,7 +273,7 @@ public HistoryRepositoryDependencies With([NotNull] IMigrationsModelDiffer model SqlGenerationHelper, ConventionSetBuilder, TypeMappingSource, - CurrentDbContext, + CurrentContext, ModelLogger, CommandLogger); @@ -293,7 +293,7 @@ public HistoryRepositoryDependencies With([NotNull] IMigrationsSqlGenerator migr SqlGenerationHelper, ConventionSetBuilder, TypeMappingSource, - CurrentDbContext, + CurrentContext, ModelLogger, CommandLogger); @@ -313,7 +313,7 @@ public HistoryRepositoryDependencies With([NotNull] ISqlGenerationHelper sqlGene sqlGenerationHelper, ConventionSetBuilder, TypeMappingSource, - CurrentDbContext, + CurrentContext, ModelLogger, CommandLogger); @@ -333,7 +333,7 @@ public HistoryRepositoryDependencies With([NotNull] IConventionSetBuilder conven SqlGenerationHelper, conventionSetBuilder, TypeMappingSource, - CurrentDbContext, + CurrentContext, ModelLogger, CommandLogger); @@ -353,16 +353,16 @@ public HistoryRepositoryDependencies With([NotNull] IRelationalTypeMappingSource SqlGenerationHelper, ConventionSetBuilder, typeMappingSource, - CurrentDbContext, + CurrentContext, ModelLogger, CommandLogger); /// /// Clones this dependency parameter object with one service replaced. /// - /// The type mapper. + /// The type mapper. /// A new parameter object with the given service replaced. - public HistoryRepositoryDependencies With([NotNull] ICurrentDbContext currentDbContext) + public HistoryRepositoryDependencies With([NotNull] ICurrentDbContext currentContext) => new HistoryRepositoryDependencies( DatabaseCreator, RawSqlCommandBuilder, @@ -373,7 +373,7 @@ public HistoryRepositoryDependencies With([NotNull] ICurrentDbContext currentDbC SqlGenerationHelper, ConventionSetBuilder, TypeMappingSource, - currentDbContext, + currentContext, ModelLogger, CommandLogger); @@ -393,7 +393,7 @@ public HistoryRepositoryDependencies With([NotNull] IDiagnosticsLogger _logger; private readonly IDiagnosticsLogger _commandLogger; private readonly string _activeProvider; @@ -61,7 +61,7 @@ public Migrator( [NotNull] IMigrationCommandExecutor migrationCommandExecutor, [NotNull] IRelationalConnection connection, [NotNull] ISqlGenerationHelper sqlGenerationHelper, - [NotNull] ICurrentDbContext currentDbContext, + [NotNull] ICurrentDbContext currentContext, [NotNull] IDiagnosticsLogger logger, [NotNull] IDiagnosticsLogger commandLogger, [NotNull] IDatabaseProvider databaseProvider) @@ -74,7 +74,7 @@ public Migrator( Check.NotNull(migrationCommandExecutor, nameof(migrationCommandExecutor)); Check.NotNull(connection, nameof(connection)); Check.NotNull(sqlGenerationHelper, nameof(sqlGenerationHelper)); - Check.NotNull(currentDbContext, nameof(currentDbContext)); + Check.NotNull(currentContext, nameof(currentContext)); Check.NotNull(logger, nameof(logger)); Check.NotNull(commandLogger, nameof(commandLogger)); Check.NotNull(databaseProvider, nameof(databaseProvider)); @@ -87,7 +87,7 @@ public Migrator( _migrationCommandExecutor = migrationCommandExecutor; _connection = connection; _sqlGenerationHelper = sqlGenerationHelper; - _currentDbContext = currentDbContext; + _currentContext = currentContext; _logger = logger; _commandLogger = commandLogger; _activeProvider = databaseProvider.Name; @@ -117,7 +117,7 @@ public virtual void Migrate(string targetMigration = null) new RelationalCommandParameterObject( _connection, null, - _currentDbContext.Context, + _currentContext.Context, _commandLogger)); } @@ -154,7 +154,7 @@ await command.ExecuteNonQueryAsync( new RelationalCommandParameterObject( _connection, null, - _currentDbContext.Context, + _currentContext.Context, _commandLogger), cancellationToken); } @@ -398,7 +398,7 @@ protected virtual IReadOnlyList GenerateUpSql([NotNull] Migrat return _migrationsSqlGenerator .Generate(migration.UpOperations, migration.TargetModel) - .Concat(new[] { new MigrationCommand(insertCommand, _currentDbContext.Context, _commandLogger) }) + .Concat(new[] { new MigrationCommand(insertCommand, _currentContext.Context, _commandLogger) }) .ToList(); } @@ -419,7 +419,7 @@ protected virtual IReadOnlyList GenerateDownSql( return _migrationsSqlGenerator .Generate(migration.DownOperations, previousMigration?.TargetModel) - .Concat(new[] { new MigrationCommand(deleteCommand, _currentDbContext.Context, _commandLogger) }) + .Concat(new[] { new MigrationCommand(deleteCommand, _currentContext.Context, _commandLogger) }) .ToList(); } } diff --git a/src/EFCore.Relational/Migrations/MigrationCommandListBuilder.cs b/src/EFCore.Relational/Migrations/MigrationCommandListBuilder.cs index 079d56aae10..22e438edc1d 100644 --- a/src/EFCore.Relational/Migrations/MigrationCommandListBuilder.cs +++ b/src/EFCore.Relational/Migrations/MigrationCommandListBuilder.cs @@ -54,7 +54,7 @@ public virtual MigrationCommandListBuilder EndCommand(bool suppressTransaction = _commands.Add( new MigrationCommand( _commandBuilder.Build(), - _dependencies.CurrentDbContext.Context, + _dependencies.CurrentContext.Context, _dependencies.Logger, suppressTransaction)); diff --git a/src/EFCore.Relational/Migrations/MigrationsSqlGeneratorDependencies.cs b/src/EFCore.Relational/Migrations/MigrationsSqlGeneratorDependencies.cs index e6a7ecb7707..035d5a99510 100644 --- a/src/EFCore.Relational/Migrations/MigrationsSqlGeneratorDependencies.cs +++ b/src/EFCore.Relational/Migrations/MigrationsSqlGeneratorDependencies.cs @@ -59,7 +59,7 @@ public sealed class MigrationsSqlGeneratorDependencies /// High level SQL generator. /// Helpers for SQL generation. /// The type mapper. - /// Contains the currently in use. + /// Contains the currently in use. /// A logger. [EntityFrameworkInternal] public MigrationsSqlGeneratorDependencies( @@ -67,21 +67,21 @@ public MigrationsSqlGeneratorDependencies( [NotNull] IUpdateSqlGenerator updateSqlGenerator, [NotNull] ISqlGenerationHelper sqlGenerationHelper, [NotNull] IRelationalTypeMappingSource typeMappingSource, - [NotNull] ICurrentDbContext currentDbContext, + [NotNull] ICurrentDbContext currentContext, [NotNull] IDiagnosticsLogger logger) { Check.NotNull(commandBuilderFactory, nameof(commandBuilderFactory)); Check.NotNull(updateSqlGenerator, nameof(updateSqlGenerator)); Check.NotNull(sqlGenerationHelper, nameof(sqlGenerationHelper)); Check.NotNull(typeMappingSource, nameof(typeMappingSource)); - Check.NotNull(currentDbContext, nameof(currentDbContext)); + Check.NotNull(currentContext, nameof(currentContext)); Check.NotNull(logger, nameof(logger)); CommandBuilderFactory = commandBuilderFactory; SqlGenerationHelper = sqlGenerationHelper; UpdateSqlGenerator = updateSqlGenerator; TypeMappingSource = typeMappingSource; - CurrentDbContext = currentDbContext; + CurrentContext = currentContext; Logger = logger; } @@ -108,7 +108,7 @@ public MigrationsSqlGeneratorDependencies( /// /// Contains the currently in use. /// - public ICurrentDbContext CurrentDbContext { get; } + public ICurrentDbContext CurrentContext { get; } /// /// A logger. @@ -126,7 +126,7 @@ public MigrationsSqlGeneratorDependencies With([NotNull] IRelationalCommandBuild UpdateSqlGenerator, SqlGenerationHelper, TypeMappingSource, - CurrentDbContext, + CurrentContext, Logger); /// @@ -140,7 +140,7 @@ public MigrationsSqlGeneratorDependencies With([NotNull] IUpdateSqlGenerator upd updateSqlGenerator, SqlGenerationHelper, TypeMappingSource, - CurrentDbContext, + CurrentContext, Logger); /// @@ -154,7 +154,7 @@ public MigrationsSqlGeneratorDependencies With([NotNull] ISqlGenerationHelper sq UpdateSqlGenerator, sqlGenerationHelper, TypeMappingSource, - CurrentDbContext, + CurrentContext, Logger); /// @@ -168,21 +168,21 @@ public MigrationsSqlGeneratorDependencies With([NotNull] IRelationalTypeMappingS UpdateSqlGenerator, SqlGenerationHelper, typeMappingSource, - CurrentDbContext, + CurrentContext, Logger); /// /// Clones this dependency parameter object with one service replaced. /// - /// A replacement for the current dependency of this type. + /// A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. - public MigrationsSqlGeneratorDependencies With([NotNull] ICurrentDbContext currentDbContext) + public MigrationsSqlGeneratorDependencies With([NotNull] ICurrentDbContext currentContext) => new MigrationsSqlGeneratorDependencies( CommandBuilderFactory, UpdateSqlGenerator, SqlGenerationHelper, TypeMappingSource, - currentDbContext, + currentContext, Logger); /// @@ -196,7 +196,7 @@ public MigrationsSqlGeneratorDependencies With([NotNull] IDiagnosticsLogger The to be used. /// The to be used. /// The to be used. - /// Contains the currently in use. + /// Contains the currently in use. /// The command logger. [EntityFrameworkInternal] public RelationalDatabaseCreatorDependencies( @@ -73,7 +73,7 @@ public RelationalDatabaseCreatorDependencies( [NotNull] IMigrationCommandExecutor migrationCommandExecutor, [NotNull] ISqlGenerationHelper sqlGenerationHelper, [NotNull] IExecutionStrategyFactory executionStrategyFactory, - [NotNull] ICurrentDbContext currentDbContext, + [NotNull] ICurrentDbContext currentContext, [NotNull] IDiagnosticsLogger commandLogger) { Check.NotNull(model, nameof(model)); @@ -83,7 +83,7 @@ public RelationalDatabaseCreatorDependencies( Check.NotNull(migrationCommandExecutor, nameof(migrationCommandExecutor)); Check.NotNull(sqlGenerationHelper, nameof(sqlGenerationHelper)); Check.NotNull(executionStrategyFactory, nameof(executionStrategyFactory)); - Check.NotNull(currentDbContext, nameof(currentDbContext)); + Check.NotNull(currentContext, nameof(currentContext)); Check.NotNull(commandLogger, nameof(commandLogger)); Model = model; @@ -93,7 +93,7 @@ public RelationalDatabaseCreatorDependencies( MigrationCommandExecutor = migrationCommandExecutor; SqlGenerationHelper = sqlGenerationHelper; ExecutionStrategyFactory = executionStrategyFactory; - CurrentDbContext = currentDbContext; + CurrentContext = currentContext; CommandLogger = commandLogger; } @@ -140,7 +140,7 @@ public RelationalDatabaseCreatorDependencies( /// /// Contains the currently in use. /// - public ICurrentDbContext CurrentDbContext { get; } + public ICurrentDbContext CurrentContext { get; } /// /// Clones this dependency parameter object with one service replaced. @@ -156,7 +156,7 @@ public RelationalDatabaseCreatorDependencies With([NotNull] IModel model) MigrationCommandExecutor, SqlGenerationHelper, ExecutionStrategyFactory, - CurrentDbContext, + CurrentContext, CommandLogger); /// @@ -173,7 +173,7 @@ public RelationalDatabaseCreatorDependencies With([NotNull] IRelationalConnectio MigrationCommandExecutor, SqlGenerationHelper, ExecutionStrategyFactory, - CurrentDbContext, + CurrentContext, CommandLogger); /// @@ -190,7 +190,7 @@ public RelationalDatabaseCreatorDependencies With([NotNull] IMigrationsModelDiff MigrationCommandExecutor, SqlGenerationHelper, ExecutionStrategyFactory, - CurrentDbContext, + CurrentContext, CommandLogger); /// @@ -207,7 +207,7 @@ public RelationalDatabaseCreatorDependencies With([NotNull] IMigrationsSqlGenera MigrationCommandExecutor, SqlGenerationHelper, ExecutionStrategyFactory, - CurrentDbContext, + CurrentContext, CommandLogger); /// @@ -224,7 +224,7 @@ public RelationalDatabaseCreatorDependencies With([NotNull] IMigrationCommandExe migrationCommandExecutor, SqlGenerationHelper, ExecutionStrategyFactory, - CurrentDbContext, + CurrentContext, CommandLogger); /// @@ -241,7 +241,7 @@ public RelationalDatabaseCreatorDependencies With([NotNull] ISqlGenerationHelper MigrationCommandExecutor, sqlGenerationHelper, ExecutionStrategyFactory, - CurrentDbContext, + CurrentContext, CommandLogger); /// @@ -258,15 +258,15 @@ public RelationalDatabaseCreatorDependencies With([NotNull] IExecutionStrategyFa MigrationCommandExecutor, SqlGenerationHelper, executionStrategyFactory, - CurrentDbContext, + CurrentContext, CommandLogger); /// /// Clones this dependency parameter object with one service replaced. /// - /// A replacement for the current dependency of this type. + /// A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. - public RelationalDatabaseCreatorDependencies With([NotNull] ICurrentDbContext currentDbContext) + public RelationalDatabaseCreatorDependencies With([NotNull] ICurrentDbContext currentContext) => new RelationalDatabaseCreatorDependencies( Model, Connection, @@ -275,7 +275,7 @@ public RelationalDatabaseCreatorDependencies With([NotNull] ICurrentDbContext cu MigrationCommandExecutor, SqlGenerationHelper, ExecutionStrategyFactory, - currentDbContext, + currentContext, CommandLogger); /// @@ -292,7 +292,7 @@ public RelationalDatabaseCreatorDependencies With([NotNull] IDiagnosticsLogger The command builder factory. /// The sql generator. /// The update generator. - /// Contains the currently in use. + /// Contains the currently in use. /// A logger. public ModificationCommandBatchFactoryDependencies( [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory, [NotNull] ISqlGenerationHelper sqlGenerationHelper, [NotNull] IUpdateSqlGenerator updateSqlGenerator, [NotNull] IRelationalValueBufferFactoryFactory valueBufferFactoryFactory, - [NotNull] ICurrentDbContext currentDbContext, + [NotNull] ICurrentDbContext currentContext, [NotNull] IDiagnosticsLogger logger) { Check.NotNull(commandBuilderFactory, nameof(commandBuilderFactory)); @@ -72,7 +72,7 @@ public ModificationCommandBatchFactoryDependencies( SqlGenerationHelper = sqlGenerationHelper; UpdateSqlGenerator = updateSqlGenerator; ValueBufferFactoryFactory = valueBufferFactoryFactory; - CurrentDbContext = currentDbContext; + CurrentContext = currentContext; Logger = logger; } @@ -104,7 +104,7 @@ public ModificationCommandBatchFactoryDependencies( /// /// Contains the currently in use. /// - public ICurrentDbContext CurrentDbContext { get; } + public ICurrentDbContext CurrentContext { get; } /// /// Clones this dependency parameter object with one service replaced. @@ -117,7 +117,7 @@ public ModificationCommandBatchFactoryDependencies With([NotNull] IDiagnosticsLo SqlGenerationHelper, UpdateSqlGenerator, ValueBufferFactoryFactory, - CurrentDbContext, + CurrentContext, logger); /// @@ -131,7 +131,7 @@ public ModificationCommandBatchFactoryDependencies With([NotNull] IRelationalVal SqlGenerationHelper, UpdateSqlGenerator, valueBufferFactoryFactory, - CurrentDbContext, + CurrentContext, Logger); /// @@ -145,7 +145,7 @@ public ModificationCommandBatchFactoryDependencies With([NotNull] IRelationalCom SqlGenerationHelper, UpdateSqlGenerator, ValueBufferFactoryFactory, - CurrentDbContext, + CurrentContext, Logger); /// @@ -159,7 +159,7 @@ public ModificationCommandBatchFactoryDependencies With([NotNull] ISqlGeneration sqlGenerationHelper, UpdateSqlGenerator, ValueBufferFactoryFactory, - CurrentDbContext, + CurrentContext, Logger); /// @@ -173,21 +173,21 @@ public ModificationCommandBatchFactoryDependencies With([NotNull] IUpdateSqlGene SqlGenerationHelper, updateSqlGenerator, ValueBufferFactoryFactory, - CurrentDbContext, + CurrentContext, Logger); /// /// Clones this dependency parameter object with one service replaced. /// - /// A replacement for the current dependency of this type. + /// A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. - public ModificationCommandBatchFactoryDependencies With([NotNull] ICurrentDbContext currentDbContext) + public ModificationCommandBatchFactoryDependencies With([NotNull] ICurrentDbContext currentContext) => new ModificationCommandBatchFactoryDependencies( CommandBuilderFactory, SqlGenerationHelper, UpdateSqlGenerator, ValueBufferFactoryFactory, - currentDbContext, + currentContext, Logger); } } diff --git a/src/EFCore.Relational/Update/ReaderModificationCommandBatch.cs b/src/EFCore.Relational/Update/ReaderModificationCommandBatch.cs index 2176ab78f27..ef8aabd7009 100644 --- a/src/EFCore.Relational/Update/ReaderModificationCommandBatch.cs +++ b/src/EFCore.Relational/Update/ReaderModificationCommandBatch.cs @@ -239,7 +239,7 @@ public override void Execute(IRelationalConnection connection) new RelationalCommandParameterObject( connection, storeCommand.ParameterValues, - Dependencies.CurrentDbContext.Context, + Dependencies.CurrentContext.Context, Dependencies.Logger))) { Consume(dataReader); @@ -276,7 +276,7 @@ public override async Task ExecuteAsync( new RelationalCommandParameterObject( connection, storeCommand.ParameterValues, - Dependencies.CurrentDbContext.Context, + Dependencies.CurrentContext.Context, Dependencies.Logger), cancellationToken)) { diff --git a/src/EFCore.SqlServer/Storage/Internal/SqlServerDatabaseCreator.cs b/src/EFCore.SqlServer/Storage/Internal/SqlServerDatabaseCreator.cs index f6e76c1839d..7c82e592b57 100644 --- a/src/EFCore.SqlServer/Storage/Internal/SqlServerDatabaseCreator.cs +++ b/src/EFCore.SqlServer/Storage/Internal/SqlServerDatabaseCreator.cs @@ -121,7 +121,7 @@ public override bool HasTables() new RelationalCommandParameterObject( connection, null, - Dependencies.CurrentDbContext.Context, + Dependencies.CurrentContext.Context, Dependencies.CommandLogger)) != 0); /// @@ -138,7 +138,7 @@ public override Task HasTablesAsync(CancellationToken cancellationToken = new RelationalCommandParameterObject( connection, null, - Dependencies.CurrentDbContext.Context, + Dependencies.CurrentContext.Context, Dependencies.CommandLogger), cancellationToken: ct) != 0, cancellationToken); diff --git a/src/EFCore.SqlServer/Storage/Internal/SqlServerExecutionStrategy.cs b/src/EFCore.SqlServer/Storage/Internal/SqlServerExecutionStrategy.cs index 8f7ebba9d64..46b1ce0d483 100644 --- a/src/EFCore.SqlServer/Storage/Internal/SqlServerExecutionStrategy.cs +++ b/src/EFCore.SqlServer/Storage/Internal/SqlServerExecutionStrategy.cs @@ -52,7 +52,7 @@ public virtual TResult Execute( { try { - return operation(Dependencies.CurrentDbContext.Context, state); + return operation(Dependencies.CurrentContext.Context, state); } catch (Exception ex) when (ExecutionStrategy.CallOnWrappedException(ex, SqlServerTransientExceptionDetector.ShouldRetryOn)) { @@ -74,7 +74,7 @@ public virtual async Task ExecuteAsync( { try { - return await operation(Dependencies.CurrentDbContext.Context, state, cancellationToken); + return await operation(Dependencies.CurrentContext.Context, state, cancellationToken); } catch (Exception ex) when (ExecutionStrategy.CallOnWrappedException(ex, SqlServerTransientExceptionDetector.ShouldRetryOn)) { diff --git a/src/EFCore/Diagnostics/IInterceptorResolver.cs b/src/EFCore/Diagnostics/IInterceptorAggregator.cs similarity index 87% rename from src/EFCore/Diagnostics/IInterceptorResolver.cs rename to src/EFCore/Diagnostics/IInterceptorAggregator.cs index 94db6a84d8e..a2b36db104f 100644 --- a/src/EFCore/Diagnostics/IInterceptorResolver.cs +++ b/src/EFCore/Diagnostics/IInterceptorAggregator.cs @@ -17,11 +17,11 @@ namespace Microsoft.EntityFrameworkCore.Diagnostics /// not used in application code. /// /// - /// Instances should be registered on the internal service provider as multiple + /// Instances should be registered on the internal service provider as multiple /// interfaces. /// /// - public interface IInterceptorResolver + public interface IInterceptorAggregator { /// /// The interceptor type. @@ -36,6 +36,6 @@ public interface IInterceptorResolver /// /// The interceptors to combine. /// The combined interceptor. - IInterceptor ResolveInterceptor([NotNull] IReadOnlyList interceptors); + IInterceptor AggregateInterceptors([NotNull] IReadOnlyList interceptors); } } diff --git a/src/EFCore/Diagnostics/IInterceptors.cs b/src/EFCore/Diagnostics/IInterceptors.cs index 3a31b6c6889..321085f825d 100644 --- a/src/EFCore/Diagnostics/IInterceptors.cs +++ b/src/EFCore/Diagnostics/IInterceptors.cs @@ -29,7 +29,7 @@ public interface IInterceptors /// /// The interceptor type to resolve. /// The resolved interceptor, which may be null if none are registered. - TInterceptor Resolve() + TInterceptor Aggregate() where TInterceptor : class, IInterceptor; } } diff --git a/src/EFCore/Diagnostics/InterceptorResolver.cs b/src/EFCore/Diagnostics/InterceptorAggregator.cs similarity index 91% rename from src/EFCore/Diagnostics/InterceptorResolver.cs rename to src/EFCore/Diagnostics/InterceptorAggregator.cs index 4e3e1e5b223..fc30a5c1ad8 100644 --- a/src/EFCore/Diagnostics/InterceptorResolver.cs +++ b/src/EFCore/Diagnostics/InterceptorAggregator.cs @@ -10,10 +10,10 @@ namespace Microsoft.EntityFrameworkCore.Diagnostics { /// - /// Abstract base class for implementations of the service. + /// Abstract base class for implementations of the service. /// /// The interceptor type. - public abstract class InterceptorResolver : IInterceptorResolver + public abstract class InterceptorAggregator : IInterceptorAggregator where TInterceptor : class, IInterceptor { private TInterceptor _interceptor; @@ -32,7 +32,7 @@ public abstract class InterceptorResolver : IInterceptorResolver /// /// The interceptors to combine. /// The combined interceptor. - public virtual IInterceptor ResolveInterceptor(IReadOnlyList interceptors) + public virtual IInterceptor AggregateInterceptors(IReadOnlyList interceptors) { Check.NotNull(interceptors, nameof(interceptors)); diff --git a/src/EFCore/Diagnostics/Internal/Interceptors.cs b/src/EFCore/Diagnostics/Internal/Interceptors.cs index c0e7b16f3f9..9cefd2f635c 100644 --- a/src/EFCore/Diagnostics/Internal/Interceptors.cs +++ b/src/EFCore/Diagnostics/Internal/Interceptors.cs @@ -20,7 +20,7 @@ public class Interceptors : IInterceptors { private readonly IServiceProvider _serviceProvider; private readonly IEnumerable _injectedInterceptors; - private readonly Dictionary _resolvers; + private readonly Dictionary _aggregators; private CoreOptionsExtension _coreOptionsExtension; private List _interceptors; @@ -32,11 +32,11 @@ public class Interceptors : IInterceptors /// public Interceptors([NotNull] IServiceProvider serviceProvider, [NotNull] IEnumerable injectedInterceptors, - [NotNull] IEnumerable interceptorResolvers) + [NotNull] IEnumerable interceptorResolvers) { _serviceProvider = serviceProvider; _injectedInterceptors = injectedInterceptors; - _resolvers = interceptorResolvers.ToDictionary(i => i.InterceptorType); + _aggregators = interceptorResolvers.ToDictionary(i => i.InterceptorType); } private IReadOnlyList RegisteredInterceptors @@ -65,9 +65,9 @@ private IReadOnlyList RegisteredInterceptors /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public virtual TInterceptor Resolve() + public virtual TInterceptor Aggregate() where TInterceptor : class, IInterceptor - => (TInterceptor)_resolvers[typeof(TInterceptor)].ResolveInterceptor(RegisteredInterceptors); + => (TInterceptor)_aggregators[typeof(TInterceptor)].AggregateInterceptors(RegisteredInterceptors); /// /// We resolve this lazily because loggers are created very early in the initialization diff --git a/src/EFCore/Internal/DbContextDependenciesExtensions.cs b/src/EFCore/Internal/DbContextDependenciesExtensions.cs index 2fb0eaacefe..7bf0286f601 100644 --- a/src/EFCore/Internal/DbContextDependenciesExtensions.cs +++ b/src/EFCore/Internal/DbContextDependenciesExtensions.cs @@ -36,7 +36,7 @@ public static IDbContextDependencies GetDependencies([NotNull] this IDbContextDe /// doing so can result in application failures when updating to a new Entity Framework Core release. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static IDbContextDependencies GetDependencies([NotNull] this ICurrentDbContext context) - => context.Context; + public static IDbContextDependencies GetDependencies([NotNull] this ICurrentDbContext currentContext) + => currentContext.Context; } } diff --git a/src/EFCore/Metadata/Conventions/IConventionContext`.cs b/src/EFCore/Metadata/Conventions/IConventionContext`.cs index c9b6a062706..4a4f04f3b91 100644 --- a/src/EFCore/Metadata/Conventions/IConventionContext`.cs +++ b/src/EFCore/Metadata/Conventions/IConventionContext`.cs @@ -8,8 +8,8 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Conventions /// /// Contextual information associated with each convention call. /// - /// The type of the metadata object. - public interface IConventionContext : IConventionContext + /// The type of the metadata object. + public interface IConventionContext : IConventionContext { /// /// @@ -20,7 +20,7 @@ public interface IConventionContext : IConventionContext /// /// /// The new metadata object. - void StopProcessing([NotNull] T result); + void StopProcessing([NotNull] TMetadata result); /// /// @@ -32,6 +32,6 @@ public interface IConventionContext : IConventionContext /// /// /// The new metadata object. - void StopProcessingIfChanged([NotNull] T result); + void StopProcessingIfChanged([NotNull] TMetadata result); } } diff --git a/src/EFCore/Metadata/Conventions/Infrastructure/ProviderConventionSetBuilderDependencies.cs b/src/EFCore/Metadata/Conventions/Infrastructure/ProviderConventionSetBuilderDependencies.cs index 5f60f37a7cf..692de6fc687 100644 --- a/src/EFCore/Metadata/Conventions/Infrastructure/ProviderConventionSetBuilderDependencies.cs +++ b/src/EFCore/Metadata/Conventions/Infrastructure/ProviderConventionSetBuilderDependencies.cs @@ -44,7 +44,7 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure /// public sealed class ProviderConventionSetBuilderDependencies { - private readonly ICurrentDbContext _context; + private readonly ICurrentDbContext _currentContext; /// /// @@ -72,7 +72,7 @@ public sealed class ProviderConventionSetBuilderDependencies /// The model logger. /// The model validation logger. /// The set finder. - /// The current context instance. + /// The current context instance. /// The model validator. public ProviderConventionSetBuilderDependencies( [NotNull] ITypeMappingSource typeMappingSource, @@ -82,7 +82,7 @@ public ProviderConventionSetBuilderDependencies( [NotNull] IDiagnosticsLogger logger, [NotNull] IDiagnosticsLogger validationLogger, [NotNull] IDbSetFinder setFinder, - [NotNull] ICurrentDbContext context, + [NotNull] ICurrentDbContext currentContext, [NotNull] IModelValidator validator) { Check.NotNull(typeMappingSource, nameof(typeMappingSource)); @@ -101,7 +101,7 @@ public ProviderConventionSetBuilderDependencies( Logger = logger; ValidationLogger = validationLogger; SetFinder = setFinder; - _context = context; + _currentContext = currentContext; ModelValidator = validator; } @@ -143,7 +143,7 @@ public ProviderConventionSetBuilderDependencies( /// /// The current context instance. /// - public Type ContextType => _context.Context.GetType(); + public Type ContextType => _currentContext.Context.GetType(); /// /// The model validator. @@ -158,7 +158,7 @@ public ProviderConventionSetBuilderDependencies( public ProviderConventionSetBuilderDependencies With([NotNull] ITypeMappingSource typeMappingSource) => new ProviderConventionSetBuilderDependencies( typeMappingSource, ConstructorBindingFactory, ParameterBindingFactories, MemberClassifier, Logger, ValidationLogger, - SetFinder, _context, ModelValidator); + SetFinder, _currentContext, ModelValidator); /// /// Clones this dependency parameter object with one service replaced. @@ -168,7 +168,7 @@ public ProviderConventionSetBuilderDependencies With([NotNull] ITypeMappingSourc public ProviderConventionSetBuilderDependencies With([NotNull] IConstructorBindingFactory constructorBindingFactory) => new ProviderConventionSetBuilderDependencies( TypeMappingSource, constructorBindingFactory, ParameterBindingFactories, MemberClassifier, Logger, ValidationLogger, - SetFinder, _context, ModelValidator); + SetFinder, _currentContext, ModelValidator); /// /// Clones this dependency parameter object with one service replaced. @@ -178,7 +178,7 @@ public ProviderConventionSetBuilderDependencies With([NotNull] IConstructorBindi public ProviderConventionSetBuilderDependencies With([NotNull] IDiagnosticsLogger logger) => new ProviderConventionSetBuilderDependencies( TypeMappingSource, ConstructorBindingFactory, ParameterBindingFactories, MemberClassifier, logger, ValidationLogger, - SetFinder, _context, ModelValidator); + SetFinder, _currentContext, ModelValidator); /// /// Clones this dependency parameter object with one service replaced. @@ -188,7 +188,7 @@ public ProviderConventionSetBuilderDependencies With([NotNull] IDiagnosticsLogge public ProviderConventionSetBuilderDependencies With([NotNull] IDiagnosticsLogger validationLogger) => new ProviderConventionSetBuilderDependencies( TypeMappingSource, ConstructorBindingFactory, ParameterBindingFactories, MemberClassifier, Logger, validationLogger, - SetFinder, _context, ModelValidator); + SetFinder, _currentContext, ModelValidator); /// /// Clones this dependency parameter object with one service replaced. @@ -198,7 +198,7 @@ public ProviderConventionSetBuilderDependencies With([NotNull] IDiagnosticsLogge public ProviderConventionSetBuilderDependencies With([NotNull] IParameterBindingFactories parameterBindingFactories) => new ProviderConventionSetBuilderDependencies( TypeMappingSource, ConstructorBindingFactory, parameterBindingFactories, MemberClassifier, Logger, ValidationLogger, - SetFinder, _context, ModelValidator); + SetFinder, _currentContext, ModelValidator); /// /// Clones this dependency parameter object with one service replaced. @@ -208,7 +208,7 @@ public ProviderConventionSetBuilderDependencies With([NotNull] IParameterBinding public ProviderConventionSetBuilderDependencies With([NotNull] IMemberClassifier memberClassifier) => new ProviderConventionSetBuilderDependencies( TypeMappingSource, ConstructorBindingFactory, ParameterBindingFactories, memberClassifier, Logger, ValidationLogger, - SetFinder, _context, ModelValidator); + SetFinder, _currentContext, ModelValidator); /// /// Clones this dependency parameter object with one service replaced. @@ -218,17 +218,17 @@ public ProviderConventionSetBuilderDependencies With([NotNull] IMemberClassifier public ProviderConventionSetBuilderDependencies With([NotNull] IDbSetFinder setFinder) => new ProviderConventionSetBuilderDependencies( TypeMappingSource, ConstructorBindingFactory, ParameterBindingFactories, MemberClassifier, Logger, ValidationLogger, - setFinder, _context, ModelValidator); + setFinder, _currentContext, ModelValidator); /// /// Clones this dependency parameter object with one service replaced. /// - /// A replacement for the current dependency of this type. + /// A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. - public ProviderConventionSetBuilderDependencies With([NotNull] ICurrentDbContext context) + public ProviderConventionSetBuilderDependencies With([NotNull] ICurrentDbContext currentContext) => new ProviderConventionSetBuilderDependencies( TypeMappingSource, ConstructorBindingFactory, ParameterBindingFactories, MemberClassifier, Logger, ValidationLogger, - SetFinder, context, ModelValidator); + SetFinder, currentContext, ModelValidator); /// /// Clones this dependency parameter object with one service replaced. @@ -238,6 +238,6 @@ public ProviderConventionSetBuilderDependencies With([NotNull] ICurrentDbContext public ProviderConventionSetBuilderDependencies With([NotNull] IModelValidator validator) => new ProviderConventionSetBuilderDependencies( TypeMappingSource, ConstructorBindingFactory, ParameterBindingFactories, MemberClassifier, Logger, ValidationLogger, - SetFinder, _context, validator); + SetFinder, _currentContext, validator); } } diff --git a/src/EFCore/Metadata/Conventions/Internal/ConventionContext.cs b/src/EFCore/Metadata/Conventions/Internal/ConventionContext.cs index a6ba41ad994..057186d5e74 100644 --- a/src/EFCore/Metadata/Conventions/Internal/ConventionContext.cs +++ b/src/EFCore/Metadata/Conventions/Internal/ConventionContext.cs @@ -9,11 +9,11 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public class ConventionContext : IConventionContext, IReadableConventionContext + public class ConventionContext : IConventionContext, IReadableConventionContext { private bool _stopProcessing; private readonly ConventionDispatcher _dispatcher; - private T _result; + private TMetadata _result; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -32,7 +32,7 @@ public ConventionContext(ConventionDispatcher dispatcher) /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public virtual T Result => _result; + public virtual TMetadata Result => _result; /// /// Calling this will prevent further processing of the associated event by other conventions. @@ -52,7 +52,7 @@ public virtual void StopProcessing() /// /// /// The new metadata object or null. - public virtual void StopProcessing(T result) + public virtual void StopProcessing(TMetadata result) { _stopProcessing = true; _result = result; @@ -68,7 +68,7 @@ public virtual void StopProcessing(T result) /// /// /// The new metadata object. - public virtual void StopProcessingIfChanged(T result) + public virtual void StopProcessingIfChanged(TMetadata result) { if (!Equals(Result, result)) { @@ -102,7 +102,7 @@ public virtual void StopProcessingIfChanged(T result) /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public virtual void ResetState(T input) + public virtual void ResetState(TMetadata input) { _stopProcessing = false; _result = input; diff --git a/src/EFCore/Query/CompiledQueryCacheKeyGenerator.cs b/src/EFCore/Query/CompiledQueryCacheKeyGenerator.cs index 01babc6c705..62f27ede7e0 100644 --- a/src/EFCore/Query/CompiledQueryCacheKeyGenerator.cs +++ b/src/EFCore/Query/CompiledQueryCacheKeyGenerator.cs @@ -64,7 +64,7 @@ protected CompiledQueryCacheKey GenerateCacheKeyCore([NotNull] Expression query, => new CompiledQueryCacheKey( Check.NotNull(query, nameof(query)), Dependencies.Model, - Dependencies.Context.Context.ChangeTracker.QueryTrackingBehavior, + Dependencies.CurrentContext.Context.ChangeTracker.QueryTrackingBehavior, async); /// diff --git a/src/EFCore/Query/CompiledQueryCacheKeyGeneratorDependencies.cs b/src/EFCore/Query/CompiledQueryCacheKeyGeneratorDependencies.cs index 99eaeeb272a..47b6ce810ac 100644 --- a/src/EFCore/Query/CompiledQueryCacheKeyGeneratorDependencies.cs +++ b/src/EFCore/Query/CompiledQueryCacheKeyGeneratorDependencies.cs @@ -59,7 +59,7 @@ public CompiledQueryCacheKeyGeneratorDependencies([NotNull] IModel model, [NotNu Check.NotNull(currentContext, nameof(currentContext)); Model = model; - Context = currentContext; + CurrentContext = currentContext; } /// @@ -70,7 +70,7 @@ public CompiledQueryCacheKeyGeneratorDependencies([NotNull] IModel model, [NotNu /// /// The context that queries will be executed for. /// - public ICurrentDbContext Context { get; } + public ICurrentDbContext CurrentContext { get; } /// /// Clones this dependency parameter object with one service replaced. @@ -78,7 +78,7 @@ public CompiledQueryCacheKeyGeneratorDependencies([NotNull] IModel model, [NotNu /// A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. public CompiledQueryCacheKeyGeneratorDependencies With([NotNull] IModel model) - => new CompiledQueryCacheKeyGeneratorDependencies(model, Context); + => new CompiledQueryCacheKeyGeneratorDependencies(model, CurrentContext); /// /// Clones this dependency parameter object with one service replaced. diff --git a/src/EFCore/Query/Pipeline/QueryCompilationContext.cs b/src/EFCore/Query/Pipeline/QueryCompilationContext.cs index 7ad70bafbdf..4bec2083e6a 100644 --- a/src/EFCore/Query/Pipeline/QueryCompilationContext.cs +++ b/src/EFCore/Query/Pipeline/QueryCompilationContext.cs @@ -35,16 +35,16 @@ public QueryCompilationContext( IQueryableMethodTranslatingExpressionVisitorFactory queryableMethodTranslatingExpressionVisitorFactory, IShapedQueryOptimizerFactory shapedQueryOptimizerFactory, IShapedQueryCompilingExpressionVisitorFactory shapedQueryCompilingExpressionVisitorFactory, - ICurrentDbContext currentDbContext, + ICurrentDbContext currentContext, IDbContextOptions contextOptions, IDiagnosticsLogger logger, bool async) { Async = async; - TrackQueryResults = currentDbContext.Context.ChangeTracker.QueryTrackingBehavior == QueryTrackingBehavior.TrackAll; + TrackQueryResults = currentContext.Context.ChangeTracker.QueryTrackingBehavior == QueryTrackingBehavior.TrackAll; Model = model; ContextOptions = contextOptions; - ContextType = currentDbContext.Context.GetType(); + ContextType = currentContext.Context.GetType(); Logger = logger; _queryOptimizerFactory = queryOptimizerFactory; diff --git a/src/EFCore/Query/Pipeline/QueryCompilationContextFactory.cs b/src/EFCore/Query/Pipeline/QueryCompilationContextFactory.cs index 164366983c7..ac11fe7dcbc 100644 --- a/src/EFCore/Query/Pipeline/QueryCompilationContextFactory.cs +++ b/src/EFCore/Query/Pipeline/QueryCompilationContextFactory.cs @@ -14,7 +14,7 @@ public class QueryCompilationContextFactory : IQueryCompilationContextFactory private readonly IQueryableMethodTranslatingExpressionVisitorFactory _queryableMethodTranslatingExpressionVisitorFactory; private readonly IShapedQueryOptimizerFactory _shapedQueryOptimizerFactory; private readonly IShapedQueryCompilingExpressionVisitorFactory _shapedQueryCompilingExpressionVisitorFactory; - private readonly ICurrentDbContext _currentDbContext; + private readonly ICurrentDbContext _currentContext; private readonly IDbContextOptions _contextOptions; private readonly IDiagnosticsLogger _logger; @@ -24,7 +24,7 @@ public QueryCompilationContextFactory( IQueryableMethodTranslatingExpressionVisitorFactory queryableMethodTranslatingExpressionVisitorFactory, IShapedQueryOptimizerFactory shapedQueryOptimizerFactory, IShapedQueryCompilingExpressionVisitorFactory shapedQueryCompilingExpressionVisitorFactory, - ICurrentDbContext currentDbContext, + ICurrentDbContext currentContext, IDbContextOptions contextOptions, IDiagnosticsLogger logger) { @@ -33,7 +33,7 @@ public QueryCompilationContextFactory( _queryableMethodTranslatingExpressionVisitorFactory = queryableMethodTranslatingExpressionVisitorFactory; _shapedQueryOptimizerFactory = shapedQueryOptimizerFactory; _shapedQueryCompilingExpressionVisitorFactory = shapedQueryCompilingExpressionVisitorFactory; - _currentDbContext = currentDbContext; + _currentContext = currentContext; _contextOptions = contextOptions; _logger = logger; } @@ -45,7 +45,7 @@ public QueryCompilationContext Create(bool async) _queryableMethodTranslatingExpressionVisitorFactory, _shapedQueryOptimizerFactory, _shapedQueryCompilingExpressionVisitorFactory, - _currentDbContext, + _currentContext, _contextOptions, _logger, async); diff --git a/src/EFCore/Query/QueryContext.cs b/src/EFCore/Query/QueryContext.cs index 72c1788a26e..8adb1c0d18f 100644 --- a/src/EFCore/Query/QueryContext.cs +++ b/src/EFCore/Query/QueryContext.cs @@ -43,7 +43,7 @@ public QueryContext( /// /// Gets the current DbContext. /// - public virtual DbContext Context => Dependencies.CurrentDbContext.Context; + public virtual DbContext Context => Dependencies.CurrentContext.Context; /// /// Parameter object containing dependencies for this service. diff --git a/src/EFCore/Query/QueryContextDependencies.cs b/src/EFCore/Query/QueryContextDependencies.cs index 413b75a1c83..8d31f978777 100644 --- a/src/EFCore/Query/QueryContextDependencies.cs +++ b/src/EFCore/Query/QueryContextDependencies.cs @@ -68,7 +68,7 @@ public QueryContextDependencies( Check.NotNull(commandLogger, nameof(commandLogger)); Check.NotNull(queryLogger, nameof(queryLogger)); - CurrentDbContext = currentContext; + CurrentContext = currentContext; ConcurrencyDetector = concurrencyDetector; CommandLogger = commandLogger; QueryLogger = queryLogger; @@ -77,22 +77,22 @@ public QueryContextDependencies( /// /// The cache being used to store value generator instances. /// - public ICurrentDbContext CurrentDbContext { get; } + public ICurrentDbContext CurrentContext { get; } /// /// Gets the change detector. /// - public IChangeDetector ChangeDetector => CurrentDbContext.GetDependencies().ChangeDetector; + public IChangeDetector ChangeDetector => CurrentContext.GetDependencies().ChangeDetector; /// /// Gets the state manager. /// - public IStateManager StateManager => CurrentDbContext.GetDependencies().StateManager; + public IStateManager StateManager => CurrentContext.GetDependencies().StateManager; /// /// Gets the query provider. /// - public IQueryProvider QueryProvider => CurrentDbContext.GetDependencies().QueryProvider; + public IQueryProvider QueryProvider => CurrentContext.GetDependencies().QueryProvider; /// /// Gets the concurrency detector. @@ -112,10 +112,10 @@ public QueryContextDependencies( /// /// Clones this dependency parameter object with one service replaced. /// - /// A replacement for the current dependency of this type. + /// A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. - public QueryContextDependencies With([NotNull] ICurrentDbContext currentDbContext) - => new QueryContextDependencies(currentDbContext, ConcurrencyDetector, CommandLogger, QueryLogger); + public QueryContextDependencies With([NotNull] ICurrentDbContext currentContext) + => new QueryContextDependencies(currentContext, ConcurrencyDetector, CommandLogger, QueryLogger); /// /// Clones this dependency parameter object with one service replaced. @@ -123,7 +123,7 @@ public QueryContextDependencies With([NotNull] ICurrentDbContext currentDbContex /// A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. public QueryContextDependencies With([NotNull] IConcurrencyDetector concurrencyDetector) - => new QueryContextDependencies(CurrentDbContext, concurrencyDetector, CommandLogger, QueryLogger); + => new QueryContextDependencies(CurrentContext, concurrencyDetector, CommandLogger, QueryLogger); /// /// Clones this dependency parameter object with one service replaced. @@ -131,7 +131,7 @@ public QueryContextDependencies With([NotNull] IConcurrencyDetector concurrencyD /// A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. public QueryContextDependencies With([NotNull] IDiagnosticsLogger commandLogger) - => new QueryContextDependencies(CurrentDbContext, ConcurrencyDetector, commandLogger, QueryLogger); + => new QueryContextDependencies(CurrentContext, ConcurrencyDetector, commandLogger, QueryLogger); /// /// Clones this dependency parameter object with one service replaced. @@ -139,6 +139,6 @@ public QueryContextDependencies With([NotNull] IDiagnosticsLogger A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. public QueryContextDependencies With([NotNull] IDiagnosticsLogger queryLogger) - => new QueryContextDependencies(CurrentDbContext, ConcurrencyDetector, CommandLogger, queryLogger); + => new QueryContextDependencies(CurrentContext, ConcurrencyDetector, CommandLogger, queryLogger); } } diff --git a/src/EFCore/Storage/ExecutionStrategy.cs b/src/EFCore/Storage/ExecutionStrategy.cs index 641c18f1c41..ff578459740 100644 --- a/src/EFCore/Storage/ExecutionStrategy.cs +++ b/src/EFCore/Storage/ExecutionStrategy.cs @@ -151,7 +151,7 @@ public virtual TResult Execute( if (Suspended) { - return operation(Dependencies.CurrentDbContext.Context, state); + return operation(Dependencies.CurrentContext.Context, state); } OnFirstExecution(); @@ -170,7 +170,7 @@ private TResult ExecuteImplementation( try { Suspended = true; - var result = operation(Dependencies.CurrentDbContext.Context, state); + var result = operation(Dependencies.CurrentContext.Context, state); Suspended = false; return result; } @@ -244,7 +244,7 @@ public virtual Task ExecuteAsync( if (Suspended) { - return operation(Dependencies.CurrentDbContext.Context, state, cancellationToken); + return operation(Dependencies.CurrentContext.Context, state, cancellationToken); } OnFirstExecution(); @@ -265,7 +265,7 @@ private async Task ExecuteImplementationAsync( try { Suspended = true; - var result = await operation(Dependencies.CurrentDbContext.Context, state, cancellationToken); + var result = await operation(Dependencies.CurrentContext.Context, state, cancellationToken); Suspended = false; return result; } @@ -309,8 +309,8 @@ private async Task ExecuteImplementationAsync( /// protected virtual void OnFirstExecution() { - if (Dependencies.CurrentDbContext.Context.Database.CurrentTransaction != null - || Dependencies.CurrentDbContext.Context.Database.GetEnlistedTransaction() != null + if (Dependencies.CurrentContext.Context.Database.CurrentTransaction != null + || Dependencies.CurrentContext.Context.Database.GetEnlistedTransaction() != null || Transaction.Current != null) { throw new InvalidOperationException( diff --git a/src/EFCore/Storage/ExecutionStrategyDependencies.cs b/src/EFCore/Storage/ExecutionStrategyDependencies.cs index 00ef63a1473..2c800b0b3f6 100644 --- a/src/EFCore/Storage/ExecutionStrategyDependencies.cs +++ b/src/EFCore/Storage/ExecutionStrategyDependencies.cs @@ -47,18 +47,18 @@ public sealed class ExecutionStrategyDependencies /// the constructor at any point in this process. /// /// - /// Indirection to the current instance. + /// Indirection to the current instance. /// The options for the current instance. /// A logger. public ExecutionStrategyDependencies( - [NotNull] ICurrentDbContext currentDbContext, + [NotNull] ICurrentDbContext currentContext, [CanBeNull] IDbContextOptions options, [CanBeNull] IDiagnosticsLogger logger) { - Check.NotNull(currentDbContext, nameof(currentDbContext)); + Check.NotNull(currentContext, nameof(currentContext)); Options = options; - CurrentDbContext = currentDbContext; + CurrentContext = currentContext; Logger = logger; } @@ -70,7 +70,7 @@ public ExecutionStrategyDependencies( /// /// Indirection to the current instance. /// - public ICurrentDbContext CurrentDbContext { get; } + public ICurrentDbContext CurrentContext { get; } /// /// The logger. @@ -80,10 +80,10 @@ public ExecutionStrategyDependencies( /// /// Clones this dependency parameter object with one service replaced. /// - /// A replacement for the current dependency of this type. + /// A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. - public ExecutionStrategyDependencies With([NotNull] ICurrentDbContext currentDbContext) - => new ExecutionStrategyDependencies(currentDbContext, Options, Logger); + public ExecutionStrategyDependencies With([NotNull] ICurrentDbContext currentContext) + => new ExecutionStrategyDependencies(currentContext, Options, Logger); /// /// Clones this dependency parameter object with one service replaced. @@ -91,7 +91,7 @@ public ExecutionStrategyDependencies With([NotNull] ICurrentDbContext currentDbC /// A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. public ExecutionStrategyDependencies With([NotNull] IDbContextOptions options) - => new ExecutionStrategyDependencies(CurrentDbContext, options, Logger); + => new ExecutionStrategyDependencies(CurrentContext, options, Logger); /// /// Clones this dependency parameter object with one service replaced. @@ -99,6 +99,6 @@ public ExecutionStrategyDependencies With([NotNull] IDbContextOptions options) /// A replacement for the current dependency of this type. /// A new parameter object with the given service replaced. public ExecutionStrategyDependencies With([NotNull] IDiagnosticsLogger logger) - => new ExecutionStrategyDependencies(CurrentDbContext, Options, logger); + => new ExecutionStrategyDependencies(CurrentContext, Options, logger); } } diff --git a/src/EFCore/Storage/Internal/NoopExecutionStrategy.cs b/src/EFCore/Storage/Internal/NoopExecutionStrategy.cs index cf4c90377a4..a409482409c 100644 --- a/src/EFCore/Storage/Internal/NoopExecutionStrategy.cs +++ b/src/EFCore/Storage/Internal/NoopExecutionStrategy.cs @@ -43,7 +43,7 @@ public NoopExecutionStrategy([NotNull] ExecutionStrategyDependencies dependencie /// public virtual TResult Execute( TState state, Func operation, Func> verifySucceeded) - => operation(Dependencies.CurrentDbContext.Context, state); + => operation(Dependencies.CurrentContext.Context, state); /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -54,6 +54,6 @@ public virtual TResult Execute( public virtual Task ExecuteAsync( TState state, Func> operation, Func>> verifySucceeded, CancellationToken cancellationToken = default) - => operation(Dependencies.CurrentDbContext.Context, state, cancellationToken); + => operation(Dependencies.CurrentContext.Context, state, cancellationToken); } } diff --git a/src/EFCore/Update/Internal/UpdateAdapterFactory.cs b/src/EFCore/Update/Internal/UpdateAdapterFactory.cs index b75395d18a2..5fb70ab199c 100644 --- a/src/EFCore/Update/Internal/UpdateAdapterFactory.cs +++ b/src/EFCore/Update/Internal/UpdateAdapterFactory.cs @@ -17,7 +17,7 @@ namespace Microsoft.EntityFrameworkCore.Update.Internal /// public class UpdateAdapterFactory : IUpdateAdapterFactory { - private readonly ICurrentDbContext _currentDbContext; + private readonly ICurrentDbContext _currentContext; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -25,9 +25,9 @@ public class UpdateAdapterFactory : IUpdateAdapterFactory /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public UpdateAdapterFactory([NotNull] ICurrentDbContext currentDbContext) + public UpdateAdapterFactory([NotNull] ICurrentDbContext currentContext) { - _currentDbContext = currentDbContext; + _currentContext = currentContext; } /// @@ -37,7 +37,7 @@ public UpdateAdapterFactory([NotNull] ICurrentDbContext currentDbContext) /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public virtual IUpdateAdapter Create() - => new UpdateAdapter(_currentDbContext.Context.GetDependencies().StateManager); + => new UpdateAdapter(_currentContext.Context.GetDependencies().StateManager); /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -47,7 +47,7 @@ public virtual IUpdateAdapter Create() /// public virtual IUpdateAdapter CreateStandalone(IModel model = null) { - var stateManager = _currentDbContext.Context.GetDependencies().StateManager; + var stateManager = _currentContext.Context.GetDependencies().StateManager; return model == null ? new UpdateAdapter(new StateManager(stateManager.Dependencies)) diff --git a/test/EFCore.Relational.Tests/Metadata/DbFunctionMetadataTests.cs b/test/EFCore.Relational.Tests/Metadata/DbFunctionMetadataTests.cs index f0ed0642c35..4f8cb54d815 100644 --- a/test/EFCore.Relational.Tests/Metadata/DbFunctionMetadataTests.cs +++ b/test/EFCore.Relational.Tests/Metadata/DbFunctionMetadataTests.cs @@ -581,26 +581,6 @@ public void DbParameters_name() Assert.Equal(typeof(int), dbFunc.Parameters[1].ClrType); } - [ConditionalFact] - public void DbParameters_NullabilityPropagation() - { - var modelBuilder = GetModelBuilder(); - - var dbFuncBuilder = modelBuilder.HasDbFunction(MethodBmi); - var dbFunc = dbFuncBuilder.Metadata; - - dbFuncBuilder.HasParameter("c").HasNullPropagation(true); - - Assert.Equal(2, dbFunc.Parameters.Count); - - Assert.Equal("c", dbFunc.Parameters[0].Name); - Assert.Equal(typeof(string), dbFunc.Parameters[0].ClrType); - Assert.Equal(true, dbFunc.Parameters[0].SupportsNullPropagation); - - Assert.Equal("d", dbFunc.Parameters[1].Name); - Assert.Equal(typeof(int), dbFunc.Parameters[1].ClrType); - } - [ConditionalFact] public void DbParameters_StoreType() {