From c476c57ed1bfc23f381fd4b1d8725f7397f6ccc4 Mon Sep 17 00:00:00 2001 From: Luke Waters Date: Tue, 17 Mar 2015 15:01:41 -0700 Subject: [PATCH] CR feedback --- src/EntityFramework.Core/DbContext.cs | 2 +- src/EntityFramework.Core/Properties/Strings.Designer.cs | 6 +++--- src/EntityFramework.Core/Properties/Strings.resx | 4 ++-- .../QueryLoggingSqlServerTest.cs | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/EntityFramework.Core/DbContext.cs b/src/EntityFramework.Core/DbContext.cs index 12bd24ce6b9..5d900831b9e 100644 --- a/src/EntityFramework.Core/DbContext.cs +++ b/src/EntityFramework.Core/DbContext.cs @@ -211,7 +211,7 @@ private DbContextServices InitializeServices(IServiceProvider serviceProvider, D _loggerFactory = serviceProvider.GetRequiredService(); _logger = _loggerFactory.CreateLogger(); - _logger.LogDebug(Strings.DebugLogWarning); + _logger.LogDebug(Strings.DebugLogWarning(nameof(LogLevel.Debug), nameof(ILoggerFactory) + "." + nameof(ILoggerFactory.MinimumLevel), nameof(LogLevel) + "." + nameof(LogLevel.Verbose))); var scopedServiceProvider = serviceProvider .GetRequiredService() diff --git a/src/EntityFramework.Core/Properties/Strings.Designer.cs b/src/EntityFramework.Core/Properties/Strings.Designer.cs index ee385242b2f..745d1d29eef 100644 --- a/src/EntityFramework.Core/Properties/Strings.Designer.cs +++ b/src/EntityFramework.Core/Properties/Strings.Designer.cs @@ -325,11 +325,11 @@ public static string DataStoreException } /// - /// Debug level logging is enabled. At this level, Entity Framework will log sensitive application data such as Sql parameter values. To hide this information configure ILoggerFactory.MinimumLevel to LogLevel.Verbose. + /// {debug} level logging is enabled. At this level, Entity Framework will log sensitive application data such as Sql parameter values. To hide this information configure {minimumLevel} to {recommendedLevel}. /// - public static string DebugLogWarning + public static string DebugLogWarning([NotNull] object debug,[NotNull] object minimumLevel, [NotNull] object recommendedLevel) { - get { return GetString("DebugLogWarning"); } + return string.Format(CultureInfo.CurrentCulture, GetString("DebugLogWarning","debug", "minimumLevel", "recommendedLevel"), debug, minimumLevel, recommendedLevel); } /// diff --git a/src/EntityFramework.Core/Properties/Strings.resx b/src/EntityFramework.Core/Properties/Strings.resx index 9645741568c..b9a3e7dff81 100644 --- a/src/EntityFramework.Core/Properties/Strings.resx +++ b/src/EntityFramework.Core/Properties/Strings.resx @@ -469,7 +469,7 @@ The navigation property '{navigation}' cannot be used for both ends of the relationship. Either specify it on the principal side or the dependent side. - Debug level logging is enabled. At this level, Entity Framework will log sensitive application data such as SQL parameter values. To hide this information configure ILoggerFactory.MinimumLevel to LogLevel.Verbose + {debug} level logging is enabled. At this level, Entity Framework will log sensitive application data such as SQL parameter values. To hide this information configure {minimumLevel} to {recommendedLevel} Property '{propertyName}' on entity type '{entityType}' is of type '{actualType}' but the generic type provided is of type '{genericType}'. @@ -477,4 +477,4 @@ The DbContextOptions object registered in the service provider must be a DbContextOptions<TContext> where TContext is the type of the DbContext being used. - + \ No newline at end of file diff --git a/test/EntityFramework.SqlServer.FunctionalTests/QueryLoggingSqlServerTest.cs b/test/EntityFramework.SqlServer.FunctionalTests/QueryLoggingSqlServerTest.cs index 9957db8f965..946c5f6b9e0 100644 --- a/test/EntityFramework.SqlServer.FunctionalTests/QueryLoggingSqlServerTest.cs +++ b/test/EntityFramework.SqlServer.FunctionalTests/QueryLoggingSqlServerTest.cs @@ -28,7 +28,7 @@ var customers .ToList(); Assert.NotNull(customers); - Assert.Equal(Internal.Strings.DebugLogWarning + @" + Assert.Equal(Internal.Strings.DebugLogWarning(nameof(LogLevel.Debug), nameof(ILoggerFactory) + "." + nameof(ILoggerFactory.MinimumLevel), nameof(LogLevel) + "." + nameof(LogLevel.Verbose)) + @" Compiling query model: 'value(Microsoft.Data.Entity.Query.EntityQueryable`1[Microsoft.Data.Entity.FunctionalTests.TestModels.Northwind.Customer])' Optimized query model: 'value(Microsoft.Data.Entity.Query.EntityQueryable`1[Microsoft.Data.Entity.FunctionalTests.TestModels.Northwind.Customer])' Tracking query sources: [_0] @@ -42,14 +42,14 @@ public virtual void Queryable_with_parameter() { using (var context = CreateContext()) { - var cities = new [] { "Seattle", "Redmond"}; + var cities = new[] { "Seattle", "Redmond" }; foreach (var city in cities) { var customers = context.Customers.Where(c => c.City == city).ToList(); } - Assert.Contains(Internal.Strings.DebugLogWarning, TestSqlLoggerFactory.Log); + Assert.Contains(Internal.Strings.DebugLogWarning(nameof(LogLevel.Debug), nameof(ILoggerFactory) + "." + nameof(ILoggerFactory.MinimumLevel), nameof(LogLevel) + "." + nameof(LogLevel.Verbose)), TestSqlLoggerFactory.Log); Assert.Equal(@"__city_0: Seattle SELECT [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[CustomerID], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] @@ -76,7 +76,7 @@ var customers .ToList(); Assert.NotNull(customers); - Assert.Equal(Internal.Strings.DebugLogWarning + @" + Assert.Equal(Internal.Strings.DebugLogWarning(nameof(LogLevel.Debug), nameof(ILoggerFactory) + "." + nameof(ILoggerFactory.MinimumLevel), nameof(LogLevel) + "." + nameof(LogLevel.Verbose)) + @" Compiling query model: 'value(Microsoft.Data.Entity.Query.EntityQueryable`1[Microsoft.Data.Entity.FunctionalTests.TestModels.Northwind.Customer]) => Include([c].Orders)' Optimized query model: 'value(Microsoft.Data.Entity.Query.EntityQueryable`1[Microsoft.Data.Entity.FunctionalTests.TestModels.Northwind.Customer])' Including navigation: 'Microsoft.Data.Entity.FunctionalTests.TestModels.Northwind.Customer.Orders'