diff --git a/src/EFCore.Relational/Diagnostics/RelationalLoggerExtensions.cs b/src/EFCore.Relational/Diagnostics/RelationalLoggerExtensions.cs index 526e87d521b..bfc9528d90d 100644 --- a/src/EFCore.Relational/Diagnostics/RelationalLoggerExtensions.cs +++ b/src/EFCore.Relational/Diagnostics/RelationalLoggerExtensions.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; +using System.Diagnostics; using System.Globalization; using System.Linq.Expressions; using System.Reflection; @@ -19,24 +20,34 @@ using Microsoft.EntityFrameworkCore.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Update; +using Microsoft.Extensions.Logging; using Remotion.Linq; namespace Microsoft.EntityFrameworkCore.Diagnostics { /// - /// 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. + /// + /// This class contains static methods used by EF Core internals and relationl database providers to + /// write information to an and a for + /// well-known events. + /// + /// + /// This type is typically used by database providers (and other extensions). It is generally + /// not used in application code. + /// /// public static class RelationalLoggerExtensions { /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The database command object. + /// Represents the method that will be called to execute the command. + /// The correlation ID associated with the given . + /// The correlation ID associated with the being used. + /// Indicates whether or not this is an async operation. + /// The time that execution began. public static void CommandExecuting( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbCommand command, @@ -97,11 +108,17 @@ private static bool ShouldLogParameterValues( && diagnostics.ShouldLogSensitiveData(); /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The database command object. + /// Represents the method that will be called to execute the command. + /// The correlation ID associated with the given . + /// The correlation ID associated with the being used. + /// The return value from the underlying method execution. + /// Indicates whether or not this is an async command. + /// The time that execution began. + /// The duration of the command execution, not including consuming results. public static void CommandExecuted( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbCommand command, @@ -162,11 +179,17 @@ private static string CommandExecuted(EventDefinitionBase definition, EventData } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The database command object. + /// Represents the method that will be called to execute the command. + /// The correlation ID associated with the given . + /// The correlation ID associated with the being used. + /// The exception that caused this failure. + /// Indicates whether or not this is an async command. + /// The time that execution began. + /// The amount of time that passed until the exception was raised. public static void CommandError( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbCommand command, @@ -227,11 +250,12 @@ private static string CommandError(EventDefinitionBase definition, EventData pay } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The time that the operation was started. + /// Indicates whether or not this is an async operation. public static void ConnectionOpening( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, @@ -273,11 +297,13 @@ private static string ConnectionOpening(EventDefinitionBase definition, EventDat } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The time that the operation was started. + /// The amount of time before the connection was opened. + /// Indicates whether or not this is an async operation. public static void ConnectionOpened( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, @@ -321,15 +347,17 @@ private static string ConnectionOpened(EventDefinitionBase definition, EventData } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The time that the operation was started. + /// Indicates whether or not this is an async operation. public static void ConnectionClosing( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, - DateTimeOffset startTime) + DateTimeOffset startTime, + bool async) { var definition = RelationalResources.LogRelationalLoggerClosingConnection(diagnostics); @@ -366,16 +394,19 @@ private static string ConnectionClosing(EventDefinitionBase definition, EventDat } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The time that the operation was started. + /// The amount of time before the connection was closed. + /// Indicates whether or not this is an async operation. public static void ConnectionClosed( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, DateTimeOffset startTime, - TimeSpan duration) + TimeSpan duration, + bool async) { var definition = RelationalResources.LogRelationalLoggerClosedConnection(diagnostics); @@ -413,11 +444,15 @@ private static string ConnectionClosed(EventDefinitionBase definition, EventData } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The exception representing the error. + /// The time that the operation was started. + /// The elapsed time before the operation failed. + /// Indicates whether or not this is an async operation. + /// A flag indicating the exception is being handled and so it should be logged at Debug level. public static void ConnectionError( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, @@ -466,17 +501,19 @@ private static string ConnectionError(EventDefinitionBase definition, EventData } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The transaction. + /// The correlation ID associated with the . + /// The time that the operation was started. public static void TransactionStarted( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, [NotNull] DbTransaction transaction, Guid transactionId, - DateTimeOffset startDate) + DateTimeOffset startTime) { var definition = RelationalResources.LogRelationalLoggerBeginningTransaction(diagnostics); @@ -499,7 +536,7 @@ public static void TransactionStarted( transaction, transactionId, connection.ConnectionId, - startDate)); + startTime)); } } @@ -512,17 +549,19 @@ private static string TransactionStarted(EventDefinitionBase definition, EventDa } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The transaction. + /// The correlation ID associated with the . + /// The time that the operation was started. public static void TransactionUsed( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, [NotNull] DbTransaction transaction, Guid transactionId, - DateTimeOffset startDate) + DateTimeOffset startTime) { var definition = RelationalResources.LogRelationalLoggerUsingTransaction(diagnostics); @@ -545,7 +584,7 @@ public static void TransactionUsed( transaction, transactionId, connection.ConnectionId, - startDate)); + startTime)); } } @@ -558,11 +597,14 @@ private static string TransactionUsed(EventDefinitionBase definition, EventData } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The transaction. + /// The correlation ID associated with the . + /// The time that the operation was started. + /// The elapsed time from when the operation was started. public static void TransactionCommitted( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, @@ -595,11 +637,14 @@ public static void TransactionCommitted( } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The transaction. + /// The correlation ID associated with the . + /// The time that the operation was started. + /// The elapsed time from when the operation was started. public static void TransactionRolledBack( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, @@ -632,17 +677,19 @@ public static void TransactionRolledBack( } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The transaction. + /// The correlation ID associated with the . + /// The time that the operation was started. public static void TransactionDisposed( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, [NotNull] DbTransaction transaction, Guid transactionId, - DateTimeOffset startDate) + DateTimeOffset startTime) { var definition = RelationalResources.LogRelationalLoggerDisposingTransaction(diagnostics); @@ -662,16 +709,21 @@ public static void TransactionDisposed( transaction, transactionId, connection.ConnectionId, - startDate)); + startTime)); } } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The transaction. + /// The correlation ID associated with the . + /// The action being taken. + /// The exception that represents the error. + /// The time that the operation was started. + /// The elapsed time from when the operation was started. public static void TransactionError( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, @@ -708,15 +760,15 @@ public static void TransactionError( } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The time that the operation was started. public static void AmbientTransactionWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, - DateTimeOffset startDate) + DateTimeOffset startTime) { var definition = RelationalResources.LogAmbientTransaction(diagnostics); @@ -736,16 +788,16 @@ public static void AmbientTransactionWarning( connection.DbConnection, connection.ConnectionId, false, - startDate)); + startTime)); } } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The transaction. public static void AmbientTransactionEnlisted( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, @@ -783,11 +835,11 @@ private static string AmbientTransactionEnlisted(EventDefinitionBase definition, } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The transaction. public static void ExplicitTransactionEnlisted( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, @@ -825,11 +877,17 @@ private static string ExplicitTransactionEnlisted(EventDefinitionBase definition } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The connection. + /// The database command object. + /// The data reader. + /// The correlation ID associated with the given . + /// The number of records in the database that were affected. + /// The number of records that were read. + /// The time that the operation was started. + /// The elapsed time from when the operation was started. public static void DataReaderDisposing( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IRelationalConnection connection, @@ -868,11 +926,11 @@ public static void DataReaderDisposing( } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The migrator. + /// The connection. public static void MigrateUsingConnection( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IMigrator migrator, @@ -914,11 +972,11 @@ private static string MigrateUsingConnection(EventDefinitionBase definition, Eve } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The migrator. + /// The migration. public static void MigrationReverting( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IMigrator migrator, @@ -955,11 +1013,11 @@ private static string MigrationReverting(EventDefinitionBase definition, EventDa } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The migrator. + /// The migration. public static void MigrationApplying( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IMigrator migrator, @@ -996,11 +1054,14 @@ private static string MigrationApplying(EventDefinitionBase definition, EventDat } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The migrator. + /// The migration. + /// The starting migration name. + /// The ending migration name. + /// Indicates whether or not an idempotent script is being generated. public static void MigrationGeneratingDownScript( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IMigrator migrator, @@ -1043,11 +1104,14 @@ private static string MigrationGeneratingDownScript(EventDefinitionBase definiti } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The migrator. + /// The migration. + /// The starting migration name. + /// The ending migration name. + /// Indicates whether or not an idempotent script is being generated. public static void MigrationGeneratingUpScript( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IMigrator migrator, @@ -1090,11 +1154,10 @@ private static string MigrationGeneratingUpScript(EventDefinitionBase definition } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The migrator. public static void MigrationsNotApplied( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IMigrator migrator) @@ -1119,11 +1182,11 @@ public static void MigrationsNotApplied( } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The migrator. + /// The assembly in which migrations are stored. public static void MigrationsNotFound( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IMigrator migrator, @@ -1160,11 +1223,10 @@ private static string MigrationsNotFound(EventDefinitionBase definition, EventDa } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// Info for the migration type. public static void MigrationAttributeMissingWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] TypeInfo migrationType) @@ -1199,11 +1261,11 @@ private static string MigrationAttributeMissingWarning(EventDefinitionBase defin } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The query model. + /// The element that is being client evaluated. public static void QueryClientEvaluationWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] QueryModel queryModel, @@ -1240,11 +1302,10 @@ private static string QueryClientEvaluationWarning(EventDefinitionBase definitio } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The expression representing the problematic method call. public static void QueryPossibleUnintendedUseOfEqualsWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] MethodCallExpression methodCallExpression) @@ -1279,11 +1340,9 @@ private static string QueryPossibleUnintendedUseOfEqualsWarning(EventDefinitionB } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. public static void QueryPossibleExceptionWithAggregateOperatorWarning( [NotNull] this IDiagnosticsLogger diagnostics) { @@ -1306,11 +1365,11 @@ public static void QueryPossibleExceptionWithAggregateOperatorWarning( } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The CLR type. + /// The value converter. public static void ValueConversionSqlLiteralWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] Type mappingClrType, @@ -1348,11 +1407,10 @@ private static string ValueConversionSqlLiteral(EventDefinitionBase definition, } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The property. public static void ModelValidationKeyDefaultValueWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IProperty property) @@ -1390,11 +1448,10 @@ private static string ModelValidationKeyDefaultValueWarning(EventDefinitionBase } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The property. public static void BoolWithDefaultWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IProperty property) @@ -1430,11 +1487,11 @@ private static string BoolWithDefaultWarning(EventDefinitionBase definition, Eve } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The entries for entities in the batch. + /// The number of commands. public static void BatchReadyForExecution( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IEnumerable entries, @@ -1471,11 +1528,12 @@ private static string BatchReadyForExecution(EventDefinitionBase definition, Eve } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The entries for entities in the batch. + /// The number of commands. + /// The minimum batch size. public static void BatchSmallerThanMinBatchSize( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IEnumerable entries, diff --git a/src/EFCore.Relational/Storage/RelationalConnection.cs b/src/EFCore.Relational/Storage/RelationalConnection.cs index c6486dcbc0d..809d328ee53 100644 --- a/src/EFCore.Relational/Storage/RelationalConnection.cs +++ b/src/EFCore.Relational/Storage/RelationalConnection.cs @@ -562,7 +562,7 @@ public virtual bool Close() var startTime = DateTimeOffset.UtcNow; var stopwatch = Stopwatch.StartNew(); - Dependencies.ConnectionLogger.ConnectionClosing(this, startTime); + Dependencies.ConnectionLogger.ConnectionClosing(this, startTime, async: false); try { @@ -570,7 +570,7 @@ public virtual bool Close() wasClosed = true; - Dependencies.ConnectionLogger.ConnectionClosed(this, startTime, stopwatch.Elapsed); + Dependencies.ConnectionLogger.ConnectionClosed(this, startTime, stopwatch.Elapsed, async: false); } catch (Exception e) { diff --git a/src/EFCore/Diagnostics/CoreLoggerExtensions.cs b/src/EFCore/Diagnostics/CoreLoggerExtensions.cs index 9960b495986..db168b97426 100644 --- a/src/EFCore/Diagnostics/CoreLoggerExtensions.cs +++ b/src/EFCore/Diagnostics/CoreLoggerExtensions.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Reflection; @@ -17,26 +18,32 @@ using Microsoft.EntityFrameworkCore.Query.Internal; using Microsoft.EntityFrameworkCore.Query.ResultOperators.Internal; using Microsoft.EntityFrameworkCore.Update; +using Microsoft.Extensions.Logging; using Remotion.Linq; namespace Microsoft.EntityFrameworkCore.Diagnostics { /// - /// 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. + /// + /// This class contains static methods used by EF Core internals and database providers to + /// write information to an and a for + /// well-known events. + /// + /// + /// This type is typically used by database providers (and other extensions). It is generally + /// not used in application code. + /// /// public static class CoreLoggerExtensions { private const int QueryModelStringLengthLimit = 100; /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The context in use. + /// The exception that caused this event. public static void SaveChangesFailed( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbContext context, @@ -74,11 +81,11 @@ private static string SaveChangesFailed(EventDefinitionBase definition, EventDat } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The context in use. + /// The exception that caused this event. public static void OptimisticConcurrencyException( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbContext context, @@ -115,11 +122,11 @@ private static string OptimisticConcurrencyException(EventDefinitionBase definit } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The first dependent type. + /// The second dependent type. public static void DuplicateDependentEntityTypeInstanceWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IEntityType dependent1, @@ -156,11 +163,11 @@ private static string DuplicateDependentEntityTypeInstanceWarning(EventDefinitio } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The type being used. + /// The exception that caused this failure. public static void QueryIterationFailed( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] Type contextType, @@ -198,11 +205,10 @@ private static string QueryIterationFailed(EventDefinitionBase definition, Event } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The query model. public static void QueryModelCompiling( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] QueryModel queryModel) @@ -237,11 +243,10 @@ private static string QueryModelCompiling(EventDefinitionBase definition, EventD } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The query model. public static void RowLimitingOperationWithoutOrderByWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] QueryModel queryModel) @@ -276,11 +281,10 @@ private static string RowLimitingOperationWithoutOrderByWarning(EventDefinitionB } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The query model. public static void FirstWithoutOrderByAndFilterWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] QueryModel queryModel) @@ -315,11 +319,10 @@ private static string FirstWithoutOrderByAndFilterWarning(EventDefinitionBase de } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The query model. public static void QueryModelOptimized( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] QueryModel queryModel) @@ -354,11 +357,10 @@ private static string QueryModelOptimized(EventDefinitionBase definition, EventD } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The result operator for the Include. public static void NavigationIncluded( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IncludeResultOperator includeResultOperator) @@ -393,11 +395,11 @@ private static string NavigationIncluded(EventDefinitionBase definition, EventDa } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// Used to create a human-readable representation of the expression tree. + /// The query expression tree. public static void QueryExecutionPlanned( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IExpressionPrinter expressionPrinter, @@ -434,11 +436,10 @@ private static string QueryExecutionPlanned(EventDefinitionBase definition, Even } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The logger category for which to log the warning. public static void SensitiveDataLoggingEnabledWarning( [NotNull] this IDiagnosticsLogger diagnostics) where TLoggerCategory : LoggerCategory, new() @@ -462,11 +463,10 @@ public static void SensitiveDataLoggingEnabledWarning( } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The result operator for the Include. public static void IncludeIgnoredWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IncludeResultOperator includeResultOperator) @@ -501,11 +501,10 @@ private static string IncludeIgnoredWarning(EventDefinitionBase definition, Even } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The navigation properties being used. public static void PossibleUnintendedCollectionNavigationNullComparisonWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IReadOnlyList navigationPath) @@ -540,11 +539,11 @@ private static string PossibleUnintendedCollectionNavigationNullComparisonWarnin } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The left side expression. + /// The right side expression. public static void PossibleUnintendedReferenceComparisonWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] Expression left, @@ -581,11 +580,10 @@ private static string PossibleUnintendedReferenceComparisonWarning(EventDefiniti } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The service provider. public static void ServiceProviderCreated( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IServiceProvider serviceProvider) @@ -610,11 +608,10 @@ public static void ServiceProviderCreated( } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The service providers that have been created. public static void ManyServiceProvidersCreatedWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] ICollection serviceProviders) @@ -639,11 +636,11 @@ public static void ManyServiceProvidersCreatedWarning( } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// Debug information for the new service providers. + /// Debug information for existing service providers. public static void ServiceProviderDebugInfo( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IDictionary newDebugInfo, @@ -724,11 +721,11 @@ private static string GenerateDebugInfoString( } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The context being used. + /// The context options being used. public static void ContextInitialized( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbContext context, @@ -772,11 +769,12 @@ private static string ContextInitialized(EventDefinitionBase definition, EventDa } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The exceptions(s) that caused the failure. + /// The delay that before the next retry. + /// Indicates whether execution is asynchronous or not. public static void ExecutionStrategyRetrying( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IReadOnlyList exceptionsEncountered, @@ -818,11 +816,12 @@ private static string ExecutionStrategyRetrying(EventDefinitionBase definition, } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The context being used. + /// The entity type. + /// The name of the navigation property. public static void LazyLoadOnDisposedContextWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbContext context, @@ -861,11 +860,12 @@ private static string LazyLoadOnDisposedContextWarning(EventDefinitionBase defin } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The context being used. + /// The entity type. + /// The name of the navigation property. public static void NavigationLazyLoading( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbContext context, @@ -904,11 +904,12 @@ private static string NavigationLazyLoading(EventDefinitionBase definition, Even } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The context being used. + /// The entity type. + /// The name of the navigation property. public static void DetachedLazyLoadingWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbContext context, @@ -947,11 +948,10 @@ private static string DetachedLazyLoadingWarning(EventDefinitionBase definition, } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The property. public static void ShadowPropertyCreated( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IProperty property) @@ -986,11 +986,11 @@ private static string ShadowPropertyCreated(EventDefinitionBase definition, Even } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The redundant index. + /// The other index. public static void RedundantIndexRemoved( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IReadOnlyList redundantIndex, @@ -1030,11 +1030,10 @@ private static string RedundantIndexRemoved(EventDefinitionBase definition, Even } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The redundant foreign key. public static void RedundantForeignKeyWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IForeignKey redundantForeignKey) @@ -1071,11 +1070,11 @@ private static string RedundantForeignKeyWarning(EventDefinitionBase definition, } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The properties that make up the foreign key. + /// The corresponding keys on the principal side. public static void IncompatibleMatchingForeignKeyProperties( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IReadOnlyList foreignKeyProperties, @@ -1115,11 +1114,10 @@ private static string IncompatibleMatchingForeignKeyProperties(EventDefinitionBa } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The navigation property. public static void RequiredAttributeOnDependent( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] INavigation navigation) @@ -1154,11 +1152,10 @@ private static string RequiredAttributeOnDependent(EventDefinitionBase definitio } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The navigation property. public static void NonNullableOnDependent( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] INavigation navigation) @@ -1193,11 +1190,11 @@ private static string NonNullableOnDependent(EventDefinitionBase definition, Eve } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The first navigation property. + /// The second navigation property. public static void RequiredAttributeOnBothNavigations( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] INavigation firstNavigation, @@ -1224,8 +1221,14 @@ public static void RequiredAttributeOnBothNavigations( new TwoPropertyBaseCollectionsEventData( definition, RequiredAttributeOnBothNavigations, - new[] { firstNavigation }, - new[] { secondNavigation })); + new[] + { + firstNavigation + }, + new[] + { + secondNavigation + })); } } @@ -1243,11 +1246,11 @@ private static string RequiredAttributeOnBothNavigations(EventDefinitionBase def } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The first navigation property. + /// The second navigation property. public static void NonNullableReferenceOnBothNavigations( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] INavigation firstNavigation, @@ -1274,8 +1277,14 @@ public static void NonNullableReferenceOnBothNavigations( new TwoPropertyBaseCollectionsEventData( definition, NonNullableReferenceOnBothNavigations, - new[] { firstNavigation }, - new[] { secondNavigation })); + new[] + { + firstNavigation + }, + new[] + { + secondNavigation + })); } } @@ -1293,11 +1302,10 @@ private static string NonNullableReferenceOnBothNavigations(EventDefinitionBase } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The foreign key. public static void ConflictingShadowForeignKeysWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IForeignKey foreignKey) @@ -1338,11 +1346,11 @@ private static string ConflictingShadowForeignKeysWarning(EventDefinitionBase de } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The first property. + /// The second property. public static void MultiplePrimaryKeyCandidates( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IProperty firstProperty, @@ -1368,8 +1376,14 @@ public static void MultiplePrimaryKeyCandidates( new TwoPropertyBaseCollectionsEventData( definition, MultiplePrimaryKeyCandidates, - new[] { firstProperty }, - new[] { secondProperty })); + new[] + { + firstProperty + }, + new[] + { + secondProperty + })); } } @@ -1386,11 +1400,11 @@ private static string MultiplePrimaryKeyCandidates(EventDefinitionBase definitio } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The first set of properties. + /// The second set of properties. public static void MultipleNavigationProperties( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IEnumerable> firstPropertyCollection, @@ -1434,11 +1448,12 @@ private static string MultipleNavigationProperties(EventDefinitionBase definitio } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The list of conflicting navigation properties. + /// The inverse navigation property. + /// The target type. public static void MultipleInversePropertiesSameTargetWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IEnumerable> conflictingNavigations, @@ -1465,7 +1480,10 @@ public static void MultipleInversePropertiesSameTargetWarning( definition, MultipleInversePropertiesSameTargetWarning, conflictingNavigations, - new[] { new Tuple(inverseNavigation, targetType) })); + new[] + { + new Tuple(inverseNavigation, targetType) + })); } } @@ -1480,11 +1498,14 @@ private static string MultipleInversePropertiesSameTargetWarning(EventDefinition } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The declaring entity type. + /// The navigation property. + /// The target type. + /// The inverse navigation property. + /// The defining navigation property. public static void NonDefiningInverseNavigationWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IEntityType declaringType, @@ -1515,8 +1536,15 @@ public static void NonDefiningInverseNavigationWarning( new TwoUnmappedPropertyCollectionsEventData( definition, NonDefiningInverseNavigationWarning, - new[] { new Tuple(navigation, declaringType.ClrType) }, - new[] { new Tuple(inverseNavigation, targetType.ClrType), new Tuple(definingNavigation, targetType.ClrType) })); + new[] + { + new Tuple(navigation, declaringType.ClrType) + }, + new[] + { + new Tuple(inverseNavigation, targetType.ClrType), + new Tuple(definingNavigation, targetType.ClrType) + })); } } @@ -1536,11 +1564,14 @@ private static string NonDefiningInverseNavigationWarning(EventDefinitionBase de } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The declaring entity type. + /// The navigation property. + /// The target type. + /// The inverse navigation property. + /// The ownership navigationb property. public static void NonOwnershipInverseNavigationWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] IEntityType declaringType, @@ -1571,8 +1602,15 @@ public static void NonOwnershipInverseNavigationWarning( new TwoUnmappedPropertyCollectionsEventData( definition, NonOwnershipInverseNavigationWarning, - new[] { new Tuple(navigation, declaringType.ClrType) }, - new[] { new Tuple(inverseNavigation, targetType.ClrType), new Tuple(ownershipNavigation, targetType.ClrType) })); + new[] + { + new Tuple(navigation, declaringType.ClrType) + }, + new[] + { + new Tuple(inverseNavigation, targetType.ClrType), + new Tuple(ownershipNavigation, targetType.ClrType) + })); } } @@ -1592,11 +1630,13 @@ private static string NonOwnershipInverseNavigationWarning(EventDefinitionBase d } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The first navigation property. + /// The second navigation property. + /// The first property. + /// The second property. public static void ForeignKeyAttributesOnBothPropertiesWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] INavigation firstNavigation, @@ -1627,8 +1667,18 @@ public static void ForeignKeyAttributesOnBothPropertiesWarning( new TwoUnmappedPropertyCollectionsEventData( definition, ForeignKeyAttributesOnBothPropertiesWarning, - new[] { new Tuple(firstNavigation.GetIdentifyingMemberInfo(), firstNavigation.DeclaringEntityType.ClrType), new Tuple(firstProperty, firstNavigation.DeclaringEntityType.ClrType) }, - new[] { new Tuple(secondNavigation.GetIdentifyingMemberInfo(), secondNavigation.DeclaringEntityType.ClrType), new Tuple(secondProperty, secondNavigation.DeclaringEntityType.ClrType) })); + new[] + { + new Tuple( + firstNavigation.GetIdentifyingMemberInfo(), firstNavigation.DeclaringEntityType.ClrType), + new Tuple(firstProperty, firstNavigation.DeclaringEntityType.ClrType) + }, + new[] + { + new Tuple( + secondNavigation.GetIdentifyingMemberInfo(), secondNavigation.DeclaringEntityType.ClrType), + new Tuple(secondProperty, secondNavigation.DeclaringEntityType.ClrType) + })); } } @@ -1650,11 +1700,11 @@ private static string ForeignKeyAttributesOnBothPropertiesWarning(EventDefinitio } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The first navigation property. + /// The second navigation property. public static void ForeignKeyAttributesOnBothNavigationsWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] INavigation firstNavigation, @@ -1681,8 +1731,14 @@ public static void ForeignKeyAttributesOnBothNavigationsWarning( new TwoPropertyBaseCollectionsEventData( definition, ForeignKeyAttributesOnBothNavigationsWarning, - new[] { firstNavigation }, - new[] { secondNavigation })); + new[] + { + firstNavigation + }, + new[] + { + secondNavigation + })); } } @@ -1700,11 +1756,11 @@ private static string ForeignKeyAttributesOnBothNavigationsWarning(EventDefiniti } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The navigation property. + /// The property. public static void ConflictingForeignKeyAttributesOnNavigationAndPropertyWarning( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] INavigation navigation, @@ -1731,12 +1787,19 @@ public static void ConflictingForeignKeyAttributesOnNavigationAndPropertyWarning new TwoUnmappedPropertyCollectionsEventData( definition, ConflictingForeignKeyAttributesOnNavigationAndPropertyWarning, - new[] { new Tuple(navigation.GetIdentifyingMemberInfo(), navigation.DeclaringEntityType.ClrType) }, - new[] { new Tuple(property, property.DeclaringType) })); + new[] + { + new Tuple(navigation.GetIdentifyingMemberInfo(), navigation.DeclaringEntityType.ClrType) + }, + new[] + { + new Tuple(property, property.DeclaringType) + })); } } - private static string ConflictingForeignKeyAttributesOnNavigationAndPropertyWarning(EventDefinitionBase definition, EventData payload) + private static string ConflictingForeignKeyAttributesOnNavigationAndPropertyWarning( + EventDefinitionBase definition, EventData payload) { var d = (EventDefinition)definition; var p = (TwoUnmappedPropertyCollectionsEventData)payload; @@ -1750,11 +1813,10 @@ private static string ConflictingForeignKeyAttributesOnNavigationAndPropertyWarn } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The context being used. public static void DetectChangesStarting( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbContext context) @@ -1789,11 +1851,10 @@ private static string DetectChangesStarting(EventDefinitionBase definition, Even } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The context being used. public static void DetectChangesCompleted( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbContext context) @@ -1828,11 +1889,13 @@ private static string DetectChangesCompleted(EventDefinitionBase definition, Eve } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. + /// The property. + /// The old value. + /// The new value. public static void PropertyChangeDetected( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] InternalEntityEntry internalEntityEntry, @@ -1876,11 +1939,13 @@ private static string PropertyChangeDetected(EventDefinitionBase definition, Eve } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. + /// The property. + /// The old value. + /// The new value. public static void PropertyChangeDetectedSensitive( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] InternalEntityEntry internalEntityEntry, @@ -1930,11 +1995,13 @@ private static string PropertyChangeDetectedSensitive(EventDefinitionBase defini } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. + /// The property. + /// The old value. + /// the new value. public static void ForeignKeyChangeDetected( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] InternalEntityEntry internalEntityEntry, @@ -1978,11 +2045,13 @@ private static string ForeignKeyChangeDetected(EventDefinitionBase definition, E } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. + /// The property. + /// The old value. + /// The new value. public static void ForeignKeyChangeDetectedSensitive( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] InternalEntityEntry internalEntityEntry, @@ -2032,11 +2101,13 @@ private static string ForeignKeyChangeDetectedSensitive(EventDefinitionBase defi } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. + /// The navigation property. + /// The added values. + /// The removed values. public static void CollectionChangeDetected( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] InternalEntityEntry internalEntityEntry, @@ -2084,11 +2155,13 @@ private static string CollectionChangeDetected(EventDefinitionBase definition, E } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. + /// The navigation property. + /// The added values. + /// The removed values. public static void CollectionChangeDetectedSensitive( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] InternalEntityEntry internalEntityEntry, @@ -2138,11 +2211,13 @@ private static string CollectionChangeDetectedSensitive(EventDefinitionBase defi } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. + /// The navigation property. + /// The old value. + /// The new value. public static void ReferenceChangeDetected( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] InternalEntityEntry internalEntityEntry, @@ -2186,11 +2261,13 @@ private static string ReferenceChangeDetected(EventDefinitionBase definition, Ev } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. + /// The navigation property. + /// The old value. + /// The new value. public static void ReferenceChangeDetectedSensitive( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] InternalEntityEntry internalEntityEntry, @@ -2236,14 +2313,13 @@ private static string ReferenceChangeDetectedSensitive(EventDefinitionBase defin } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. public static void StartedTracking( [NotNull] this IDiagnosticsLogger diagnostics, - [NotNull] InternalEntityEntry entry) + [NotNull] InternalEntityEntry internalEntityEntry) { var definition = CoreResources.LogStartedTracking(diagnostics); @@ -2253,8 +2329,8 @@ public static void StartedTracking( definition.Log( diagnostics, warningBehavior, - entry.StateManager.Context.GetType().ShortDisplayName(), - entry.EntityType.ShortName()); + internalEntityEntry.StateManager.Context.GetType().ShortDisplayName(), + internalEntityEntry.EntityType.ShortName()); } if (diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name)) @@ -2264,7 +2340,7 @@ public static void StartedTracking( new EntityEntryEventData( definition, StartedTracking, - new EntityEntry(entry))); + new EntityEntry(internalEntityEntry))); } } @@ -2278,14 +2354,13 @@ private static string StartedTracking(EventDefinitionBase definition, EventData } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. public static void StartedTrackingSensitive( [NotNull] this IDiagnosticsLogger diagnostics, - [NotNull] InternalEntityEntry entry) + [NotNull] InternalEntityEntry internalEntityEntry) { var definition = CoreResources.LogStartedTrackingSensitive(diagnostics); @@ -2295,9 +2370,9 @@ public static void StartedTrackingSensitive( definition.Log( diagnostics, warningBehavior, - entry.StateManager.Context.GetType().ShortDisplayName(), - entry.EntityType.ShortName(), - entry.BuildCurrentValuesString(entry.EntityType.FindPrimaryKey().Properties)); + internalEntityEntry.StateManager.Context.GetType().ShortDisplayName(), + internalEntityEntry.EntityType.ShortName(), + internalEntityEntry.BuildCurrentValuesString(internalEntityEntry.EntityType.FindPrimaryKey().Properties)); } if (diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name)) @@ -2307,7 +2382,7 @@ public static void StartedTrackingSensitive( new EntityEntryEventData( definition, StartedTrackingSensitive, - new EntityEntry(entry))); + new EntityEntry(internalEntityEntry))); } } @@ -2322,14 +2397,15 @@ private static string StartedTrackingSensitive(EventDefinitionBase definition, E } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. + /// The old value. + /// The new value. public static void StateChanged( [NotNull] this IDiagnosticsLogger diagnostics, - [NotNull] InternalEntityEntry entry, + [NotNull] InternalEntityEntry internalEntityEntry, EntityState oldState, EntityState newState) { @@ -2341,8 +2417,8 @@ public static void StateChanged( definition.Log( diagnostics, warningBehavior, - entry.EntityType.ShortName(), - entry.StateManager.Context.GetType().ShortDisplayName(), + internalEntityEntry.EntityType.ShortName(), + internalEntityEntry.StateManager.Context.GetType().ShortDisplayName(), oldState, newState); } @@ -2354,7 +2430,7 @@ public static void StateChanged( new StateChangedEventData( definition, StateChanged, - new EntityEntry(entry), + new EntityEntry(internalEntityEntry), oldState, newState)); } @@ -2372,14 +2448,15 @@ private static string StateChanged(EventDefinitionBase definition, EventData pay } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. + /// The old state. + /// The new state. public static void StateChangedSensitive( [NotNull] this IDiagnosticsLogger diagnostics, - [NotNull] InternalEntityEntry entry, + [NotNull] InternalEntityEntry internalEntityEntry, EntityState oldState, EntityState newState) { @@ -2391,9 +2468,9 @@ public static void StateChangedSensitive( definition.Log( diagnostics, warningBehavior, - entry.EntityType.ShortName(), - entry.BuildCurrentValuesString(entry.EntityType.FindPrimaryKey().Properties), - entry.StateManager.Context.GetType().ShortDisplayName(), + internalEntityEntry.EntityType.ShortName(), + internalEntityEntry.BuildCurrentValuesString(internalEntityEntry.EntityType.FindPrimaryKey().Properties), + internalEntityEntry.StateManager.Context.GetType().ShortDisplayName(), oldState, newState); } @@ -2405,7 +2482,7 @@ public static void StateChangedSensitive( new StateChangedEventData( definition, StateChangedSensitive, - new EntityEntry(entry), + new EntityEntry(internalEntityEntry), oldState, newState)); } @@ -2424,14 +2501,16 @@ private static string StateChangedSensitive(EventDefinitionBase definition, Even } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. + /// The property. + /// The value generated. + /// Indicates whether or not the value is a temporary or permanent value. public static void ValueGenerated( [NotNull] this IDiagnosticsLogger diagnostics, - [NotNull] InternalEntityEntry entry, + [NotNull] InternalEntityEntry internalEntityEntry, [NotNull] IProperty property, [CanBeNull] object value, bool temporary) @@ -2446,9 +2525,9 @@ public static void ValueGenerated( definition.Log( diagnostics, warningBehavior, - entry.StateManager.Context.GetType().ShortDisplayName(), + internalEntityEntry.StateManager.Context.GetType().ShortDisplayName(), property.Name, - entry.EntityType.ShortName()); + internalEntityEntry.EntityType.ShortName()); } if (diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name)) @@ -2458,7 +2537,7 @@ public static void ValueGenerated( new PropertyValueEventData( definition, ValueGenerated, - new EntityEntry(entry), + new EntityEntry(internalEntityEntry), property, value)); } @@ -2475,14 +2554,16 @@ private static string ValueGenerated(EventDefinitionBase definition, EventData p } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The internal entity entry. + /// The property. + /// The value generated. + /// Indicates whether or not the value is a temporary or permanent value. public static void ValueGeneratedSensitive( [NotNull] this IDiagnosticsLogger diagnostics, - [NotNull] InternalEntityEntry entry, + [NotNull] InternalEntityEntry internalEntityEntry, [NotNull] IProperty property, [CanBeNull] object value, bool temporary) @@ -2497,10 +2578,10 @@ public static void ValueGeneratedSensitive( definition.Log( diagnostics, warningBehavior, - entry.StateManager.Context.GetType().ShortDisplayName(), + internalEntityEntry.StateManager.Context.GetType().ShortDisplayName(), value, property.Name, - entry.EntityType.ShortName()); + internalEntityEntry.EntityType.ShortName()); } if (diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name)) @@ -2510,7 +2591,7 @@ public static void ValueGeneratedSensitive( new PropertyValueEventData( definition, ValueGeneratedSensitive, - new EntityEntry(entry), + new EntityEntry(internalEntityEntry), property, value)); } @@ -2528,15 +2609,16 @@ private static string ValueGeneratedSensitive(EventDefinitionBase definition, Ev } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The child internal entity entry. + /// The parent internal entity entry. + /// The target state. public static void CascadeDelete( [NotNull] this IDiagnosticsLogger diagnostics, - [NotNull] InternalEntityEntry childEntry, - [NotNull] InternalEntityEntry parentEntry, + [NotNull] InternalEntityEntry internalChildEntry, + [NotNull] InternalEntityEntry internalParentEntry, EntityState state) { var definition = CoreResources.LogCascadeDelete(diagnostics); @@ -2547,9 +2629,9 @@ public static void CascadeDelete( definition.Log( diagnostics, warningBehavior, - childEntry.EntityType.ShortName(), + internalChildEntry.EntityType.ShortName(), state, - parentEntry.EntityType.ShortName()); + internalParentEntry.EntityType.ShortName()); } if (diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name)) @@ -2559,8 +2641,8 @@ public static void CascadeDelete( new CascadeDeleteEventData( definition, CascadeDelete, - new EntityEntry(childEntry), - new EntityEntry(parentEntry), + new EntityEntry(internalChildEntry), + new EntityEntry(internalParentEntry), state)); } } @@ -2576,15 +2658,16 @@ private static string CascadeDelete(EventDefinitionBase definition, EventData pa } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The child internal entity entry. + /// The parent internal entity entry. + /// The target state. public static void CascadeDeleteSensitive( [NotNull] this IDiagnosticsLogger diagnostics, - [NotNull] InternalEntityEntry childEntry, - [NotNull] InternalEntityEntry parentEntry, + [NotNull] InternalEntityEntry internalChildEntry, + [NotNull] InternalEntityEntry internalParentEntry, EntityState state) { var definition = CoreResources.LogCascadeDeleteSensitive(diagnostics); @@ -2595,11 +2678,11 @@ public static void CascadeDeleteSensitive( definition.Log( diagnostics, warningBehavior, - childEntry.EntityType.ShortName(), - childEntry.BuildCurrentValuesString(childEntry.EntityType.FindPrimaryKey().Properties), + internalChildEntry.EntityType.ShortName(), + internalChildEntry.BuildCurrentValuesString(internalChildEntry.EntityType.FindPrimaryKey().Properties), state, - parentEntry.EntityType.ShortName(), - parentEntry.BuildCurrentValuesString(parentEntry.EntityType.FindPrimaryKey().Properties)); + internalParentEntry.EntityType.ShortName(), + internalParentEntry.BuildCurrentValuesString(internalParentEntry.EntityType.FindPrimaryKey().Properties)); } if (diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name)) @@ -2609,8 +2692,8 @@ public static void CascadeDeleteSensitive( new CascadeDeleteEventData( definition, CascadeDeleteSensitive, - new EntityEntry(childEntry), - new EntityEntry(parentEntry), + new EntityEntry(internalChildEntry), + new EntityEntry(internalParentEntry), state)); } } @@ -2628,14 +2711,15 @@ private static string CascadeDeleteSensitive(EventDefinitionBase definition, Eve } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The child internal entity entry. + /// The parent entity type. + /// The target state. public static void CascadeDeleteOrphan( [NotNull] this IDiagnosticsLogger diagnostics, - [NotNull] InternalEntityEntry childEntry, + [NotNull] InternalEntityEntry internalChildEntry, [NotNull] IEntityType parentEntityType, EntityState state) { @@ -2647,7 +2731,7 @@ public static void CascadeDeleteOrphan( definition.Log( diagnostics, warningBehavior, - childEntry.EntityType.ShortName(), + internalChildEntry.EntityType.ShortName(), state, parentEntityType.ShortName()); } @@ -2659,7 +2743,7 @@ public static void CascadeDeleteOrphan( new CascadeDeleteOrphanEventData( definition, CascadeDeleteOrphan, - new EntityEntry(childEntry), + new EntityEntry(internalChildEntry), parentEntityType, state)); } @@ -2676,14 +2760,15 @@ private static string CascadeDeleteOrphan(EventDefinitionBase definition, EventD } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The child internal entity entry. + /// The parent entity type. + /// The target state. public static void CascadeDeleteOrphanSensitive( [NotNull] this IDiagnosticsLogger diagnostics, - [NotNull] InternalEntityEntry childEntry, + [NotNull] InternalEntityEntry internalChildEntry, [NotNull] IEntityType parentEntityType, EntityState state) { @@ -2695,8 +2780,8 @@ public static void CascadeDeleteOrphanSensitive( definition.Log( diagnostics, warningBehavior, - childEntry.EntityType.ShortName(), - childEntry.BuildCurrentValuesString(childEntry.EntityType.FindPrimaryKey().Properties), + internalChildEntry.EntityType.ShortName(), + internalChildEntry.BuildCurrentValuesString(internalChildEntry.EntityType.FindPrimaryKey().Properties), state, parentEntityType.ShortName()); } @@ -2708,7 +2793,7 @@ public static void CascadeDeleteOrphanSensitive( new CascadeDeleteOrphanEventData( definition, CascadeDeleteOrphanSensitive, - new EntityEntry(childEntry), + new EntityEntry(internalChildEntry), parentEntityType, state)); } @@ -2726,11 +2811,10 @@ private static string CascadeDeleteOrphanSensitive(EventDefinitionBase definitio } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The context being used. public static void SaveChangesStarting( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbContext context) @@ -2765,11 +2849,11 @@ private static string SaveChangesStarting(EventDefinitionBase definition, EventD } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The context being used. + /// The number of entities saved. public static void SaveChangesCompleted( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbContext context, @@ -2809,11 +2893,10 @@ private static string SaveChangesCompleted(EventDefinitionBase definition, Event } /// - /// 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. + /// Logs for the event. /// + /// The diagnostics logger to use. + /// The context being used. public static void ContextDisposed( [NotNull] this IDiagnosticsLogger diagnostics, [NotNull] DbContext context) diff --git a/src/EFCore/Storage/DatabaseProvider.cs b/src/EFCore/Storage/DatabaseProvider.cs index 61853f1b8eb..5cbad61459e 100644 --- a/src/EFCore/Storage/DatabaseProvider.cs +++ b/src/EFCore/Storage/DatabaseProvider.cs @@ -19,12 +19,6 @@ namespace Microsoft.EntityFrameworkCore.Storage /// not used in application code. /// /// - /// 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. - /// - /// /// The service lifetime is . This means a single instance /// is used by many instances. The implementation must be thread-safe. /// This service cannot depend on services registered as . diff --git a/src/EFCore/ValueGeneration/HiLoValueGenerator.cs b/src/EFCore/ValueGeneration/HiLoValueGenerator.cs index af34a75bec9..73af4562389 100644 --- a/src/EFCore/ValueGeneration/HiLoValueGenerator.cs +++ b/src/EFCore/ValueGeneration/HiLoValueGenerator.cs @@ -60,11 +60,10 @@ public override ValueTask NextAsync( protected abstract long GetNewLowValue(); /// - /// 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. + /// Gets the low value for the next block of values to be used. /// + /// The cancellation token. + /// The low value for the next block of values to be used. protected virtual Task GetNewLowValueAsync(CancellationToken cancellationToken = default) => Task.FromResult(GetNewLowValue()); } diff --git a/test/EFCore.SqlServer.FunctionalTests/EverythingIsStringsSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/EverythingIsStringsSqlServerTest.cs index 44062ce0d88..222b5a2e548 100644 --- a/test/EFCore.SqlServer.FunctionalTests/EverythingIsStringsSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/EverythingIsStringsSqlServerTest.cs @@ -217,12 +217,6 @@ private readonly SqlServerStringTypeMapping _variableLengthAnsiString private readonly Dictionary _storeTypeMappings; - /// - /// 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 SqlServerStringsTypeMappingSource( TypeMappingSourceDependencies dependencies, RelationalTypeMappingSourceDependencies relationalDependencies)