From c69926a8cdd05f4427e89ac8bac734e490b3d23a Mon Sep 17 00:00:00 2001 From: AndriySvyryd Date: Tue, 10 Dec 2019 11:42:49 -0800 Subject: [PATCH] Fix merge --- .../Metadata/Internal/CosmosPropertyExtensions.cs | 3 ++- .../Update/Internal/DocumentSource.cs | 4 ++-- src/EFCore/Diagnostics/CoreLoggerExtensions.cs | 15 +++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/EFCore.Cosmos/Metadata/Internal/CosmosPropertyExtensions.cs b/src/EFCore.Cosmos/Metadata/Internal/CosmosPropertyExtensions.cs index 5453ff4bc11..240e5b9973b 100644 --- a/src/EFCore.Cosmos/Metadata/Internal/CosmosPropertyExtensions.cs +++ b/src/EFCore.Cosmos/Metadata/Internal/CosmosPropertyExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Diagnostics; +using JetBrains.Annotations; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Utilities; @@ -21,7 +22,7 @@ public static class CosmosPropertyExtensions /// 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 static bool IsOrdinalKeyProperty(this IProperty property) + public static bool IsOrdinalKeyProperty([NotNull] this IProperty property) { Check.DebugAssert(property.DeclaringEntityType.IsOwned(), $"Expected {property.DeclaringEntityType.DisplayName()} to be owned."); Check.DebugAssert(property.GetJsonPropertyName().Length == 0, $"Expected {property.Name} to be non-persisted."); diff --git a/src/EFCore.Cosmos/Update/Internal/DocumentSource.cs b/src/EFCore.Cosmos/Update/Internal/DocumentSource.cs index 42fd0343f57..5ff9b03edaf 100644 --- a/src/EFCore.Cosmos/Update/Internal/DocumentSource.cs +++ b/src/EFCore.Cosmos/Update/Internal/DocumentSource.cs @@ -139,7 +139,7 @@ public virtual JObject CreateDocument([NotNull] IUpdateEntry entry, int? ordinal /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public virtual JObject UpdateDocument([NotNull] JObject document, IUpdateEntry entry) + public virtual JObject UpdateDocument([NotNull] JObject document, [NotNull] IUpdateEntry entry) => UpdateDocument(document, entry, null); /// @@ -148,7 +148,7 @@ public virtual JObject UpdateDocument([NotNull] JObject document, IUpdateEntry e /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public virtual JObject UpdateDocument([NotNull] JObject document, IUpdateEntry entry, int? ordinal) + public virtual JObject UpdateDocument([NotNull] JObject document, [NotNull] IUpdateEntry entry, int? ordinal) { var anyPropertyUpdated = false; var stateManager = ((InternalEntityEntry)entry).StateManager; diff --git a/src/EFCore/Diagnostics/CoreLoggerExtensions.cs b/src/EFCore/Diagnostics/CoreLoggerExtensions.cs index 3dedf4aa109..41633a63be7 100644 --- a/src/EFCore/Diagnostics/CoreLoggerExtensions.cs +++ b/src/EFCore/Diagnostics/CoreLoggerExtensions.cs @@ -910,20 +910,19 @@ public static void RedundantAddServicesCallWarning( { var definition = CoreResources.LogRedundantAddServicesCall(diagnostics); - var warningBehavior = definition.GetLogBehavior(diagnostics); - if (warningBehavior != WarningBehavior.Ignore) + if (diagnostics.ShouldLog(definition)) { - definition.Log(diagnostics, warningBehavior); + definition.Log(diagnostics); } - if (diagnostics.DiagnosticSource.IsEnabled(definition.EventId.Name)) + if (diagnostics.NeedsEventData(definition, out var diagnosticSourceEnabled, out var simpleLogEnabled)) { - diagnostics.DiagnosticSource.Write( - definition.EventId.Name, - new ServiceProviderEventData( + var eventData = new ServiceProviderEventData( definition, (d, p) => ((EventDefinition)d).GenerateMessage(), - serviceProvider)); + serviceProvider); + + diagnostics.DispatchEventData(definition, eventData, diagnosticSourceEnabled, simpleLogEnabled); } }