From 6ff7f3bde1ee27be0cb5c42b9c2bd900b312ff8a Mon Sep 17 00:00:00 2001 From: Smit Patel Date: Thu, 3 Sep 2020 10:42:37 -0700 Subject: [PATCH 1/2] Continuation of exception message review Part of #7201 --- .../CosmosSqlTranslatingExpressionVisitor.cs | 24 +++++-- ...yExpressionTranslatingExpressionVisitor.cs | 34 +++++++--- .../Properties/RelationalStrings.Designer.cs | 38 +++++++++++ .../Properties/RelationalStrings.resx | 15 ++++ .../Query/Internal/BufferedDataReader.cs | 10 +-- ...sitor.ShaperProcessingExpressionVisitor.cs | 10 +-- ...lationalSqlTranslatingExpressionVisitor.cs | 33 ++++++--- ...ypedRelationalValueBufferFactoryFactory.cs | 10 +-- src/EFCore/Properties/CoreStrings.Designer.cs | 68 +++---------------- src/EFCore/Properties/CoreStrings.resx | 30 ++------ .../Storage/ValueConversion/ValueConverter.cs | 2 +- .../Query/FromSqlQueryTestBase.cs | 8 +-- .../Query/QueryBugsTest.cs | 2 +- .../Query/BadDataSqliteTest.cs | 10 +-- .../Storage/EnumToNumberConverterTest.cs | 2 +- .../Storage/NumberToBytesConverterTest.cs | 2 +- .../Storage/NumberToStringConverterTest.cs | 2 +- .../Storage/StringToNumberConverterTest.cs | 2 +- 18 files changed, 168 insertions(+), 134 deletions(-) diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs b/src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs index 8e5e560d700..f9d32700f96 100644 --- a/src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs +++ b/src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs @@ -188,7 +188,8 @@ protected override Expression VisitBinary(BinaryExpression binaryExpression) if ((binaryExpression.NodeType == ExpressionType.Equal || binaryExpression.NodeType == ExpressionType.NotEqual) // Visited expression could be null, We need to pass MemberInitExpression - && TryRewriteEntityEquality(binaryExpression.NodeType, visitedLeft ?? left, visitedRight ?? right, out var result)) + && TryRewriteEntityEquality( + binaryExpression.NodeType, visitedLeft ?? left, visitedRight ?? right, equalsMethod: false, out var result)) { return result; } @@ -394,6 +395,7 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp ExpressionType.Equal, left ?? methodCallExpression.Object, right ?? methodCallExpression.Arguments[0], + equalsMethod: true, out var result)) { return result; @@ -421,6 +423,7 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp ExpressionType.Equal, left ?? methodCallExpression.Arguments[0], right ?? methodCallExpression.Arguments[1], + equalsMethod: true, out var result)) { return result; @@ -720,13 +723,14 @@ private bool TryRewriteContainsEntity(Expression source, Expression item, out Ex var primaryKeyProperties = entityType.FindPrimaryKey()?.Properties; if (primaryKeyProperties == null) { - throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported(entityType.DisplayName())); + throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported( + nameof(Queryable.Contains), entityType.DisplayName())); } if (primaryKeyProperties.Count > 1) { throw new InvalidOperationException( - CoreStrings.EntityEqualityContainsWithCompositeKeyNotSupported(entityType.DisplayName())); + CoreStrings.EntityEqualityOnCompositeKeyEntitySubqueryNotSupported(nameof(Queryable.Contains), entityType.DisplayName())); } var property = primaryKeyProperties[0]; @@ -777,7 +781,7 @@ when sqlParameterExpression.Name.StartsWith(QueryCompilationContext.QueryParamet return true; } - private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left, Expression right, out Expression result) + private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left, Expression right, bool equalsMethod, out Expression result) { var leftEntityReference = left as EntityReferenceExpression; var rightEntityReference = right as EntityReferenceExpression; @@ -797,7 +801,11 @@ private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left, var primaryKeyProperties1 = entityType1.FindPrimaryKey()?.Properties; if (primaryKeyProperties1 == null) { - throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported(entityType1.DisplayName())); + throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported( + nodeType == ExpressionType.Equal + ? equalsMethod ? nameof(object.Equals) : "==" + : equalsMethod ? "!" + nameof(object.Equals) : "!=", + entityType1.DisplayName())); } result = Visit( @@ -828,7 +836,11 @@ private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left, var primaryKeyProperties = entityType.FindPrimaryKey()?.Properties; if (primaryKeyProperties == null) { - throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported(entityType.DisplayName())); + throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported( + nodeType == ExpressionType.Equal + ? equalsMethod ? nameof(object.Equals) : "==" + : equalsMethod ? "!" + nameof(object.Equals) : "!=", + entityType.DisplayName())); } result = Visit( diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs index bcee5961bf8..31a74ec69eb 100644 --- a/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs +++ b/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs @@ -166,7 +166,11 @@ protected override Expression VisitBinary(BinaryExpression binaryExpression) || binaryExpression.NodeType == ExpressionType.NotEqual) // Visited expression could be null, We need to pass MemberInitExpression && TryRewriteEntityEquality( - binaryExpression.NodeType, newLeft ?? binaryExpression.Left, newRight ?? binaryExpression.Right, out var result)) + binaryExpression.NodeType, + newLeft ?? binaryExpression.Left, + newRight ?? binaryExpression.Right, + equalsMethod: false, + out var result)) { return result; } @@ -710,6 +714,7 @@ static Expression RemapLambda(GroupingElementExpression groupingElement, LambdaE ExpressionType.Equal, left ?? methodCallExpression.Object, right ?? methodCallExpression.Arguments[0], + equalsMethod: true, out var result)) { return result; @@ -743,6 +748,7 @@ static Expression RemapLambda(GroupingElementExpression groupingElement, LambdaE ExpressionType.Equal, left ?? methodCallExpression.Arguments[0], right ?? methodCallExpression.Arguments[1], + equalsMethod: true, out var result)) { return result; @@ -1202,13 +1208,14 @@ private bool TryRewriteContainsEntity(Expression source, Expression item, out Ex var primaryKeyProperties = entityType.FindPrimaryKey()?.Properties; if (primaryKeyProperties == null) { - throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported(entityType.DisplayName())); + throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported( + nameof(Queryable.Contains), entityType.DisplayName())); } if (primaryKeyProperties.Count > 1) { throw new InvalidOperationException( - CoreStrings.EntityEqualityContainsWithCompositeKeyNotSupported(entityType.DisplayName())); + CoreStrings.EntityEqualityOnCompositeKeyEntitySubqueryNotSupported(nameof(Queryable.Contains), entityType.DisplayName())); } var property = primaryKeyProperties[0]; @@ -1261,7 +1268,7 @@ when methodCallExpression.Method.IsGenericMethod return true; } - private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left, Expression right, out Expression result) + private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left, Expression right, bool equalsMethod, out Expression result) { var leftEntityReference = left as EntityReferenceExpression; var rightEntityReference = right as EntityReferenceExpression; @@ -1281,7 +1288,11 @@ private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left, var primaryKeyProperties1 = entityType1.FindPrimaryKey()?.Properties; if (primaryKeyProperties1 == null) { - throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported(entityType1.DisplayName())); + throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported( + nodeType == ExpressionType.Equal + ? equalsMethod ? nameof(object.Equals) : "==" + : equalsMethod ? "!" + nameof(object.Equals) : "!=", + entityType1.DisplayName())); } result = Visit( @@ -1312,15 +1323,22 @@ private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left, var primaryKeyProperties = entityType.FindPrimaryKey()?.Properties; if (primaryKeyProperties == null) { - throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported(entityType.DisplayName())); + throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported( + nodeType == ExpressionType.Equal + ? equalsMethod ? nameof(object.Equals) : "==" + : equalsMethod ? "!" + nameof(object.Equals) : "!=", + entityType.DisplayName())); } if (primaryKeyProperties.Count > 1 && (leftEntityReference?.SubqueryEntity != null || rightEntityReference?.SubqueryEntity != null)) { - throw new InvalidOperationException( - CoreStrings.EntityEqualitySubqueryWithCompositeKeyNotSupported(entityType.DisplayName())); + throw new InvalidOperationException(CoreStrings.EntityEqualityOnCompositeKeyEntitySubqueryNotSupported( + nodeType == ExpressionType.Equal + ? equalsMethod ? nameof(object.Equals) : "==" + : equalsMethod ? "!" + nameof(object.Equals) : "!=", + entityType.DisplayName())); } result = Visit( diff --git a/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs b/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs index eee1a0b6f3c..c42d0acb7ca 100644 --- a/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs +++ b/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs @@ -475,6 +475,44 @@ public static string EitherOfTwoValuesMustBeNull([CanBeNull] object param1, [Can GetString("EitherOfTwoValuesMustBeNull", nameof(param1), nameof(param2)), param1, param2); + /// + /// An error occurred while reading a database value for property '{entityType}.{property}'. See the inner exception for more information. + /// + public static string ErrorMaterializingProperty([CanBeNull] object entityType, [CanBeNull] object property) + => string.Format( + GetString("ErrorMaterializingProperty", nameof(entityType), nameof(property)), + entityType, property); + + /// + /// An error occurred while reading a database value for property '{entityType}.{property}'. The expected type was '{expectedType}' but the actual value was null. + /// + public static string ErrorMaterializingPropertyNullReference([CanBeNull] object entityType, [CanBeNull] object property, [CanBeNull] object expectedType) + => string.Format( + GetString("ErrorMaterializingPropertyNullReference", nameof(entityType), nameof(property), nameof(expectedType)), + entityType, property, expectedType); + + /// + /// An error occurred while reading a database value. See the inner exception for more information. + /// + public static string ErrorMaterializingValue + => GetString("ErrorMaterializingValue"); + + /// + /// An error occurred while reading a database value. The expected type was '{expectedType}' but the actual value was of type '{actualType}'. + /// + public static string ErrorMaterializingValueInvalidCast([CanBeNull] object expectedType, [CanBeNull] object actualType) + => string.Format( + GetString("ErrorMaterializingValueInvalidCast", nameof(expectedType), nameof(actualType)), + expectedType, actualType); + + /// + /// An error occurred while reading a database value. The expected type was '{expectedType}' but the actual value was null. + /// + public static string ErrorMaterializingValueNullReference([CanBeNull] object expectedType) + => string.Format( + GetString("ErrorMaterializingValueNullReference", nameof(expectedType)), + expectedType); + /// /// The required column '{column}' was not present in the results of a 'FromSql' operation. /// diff --git a/src/EFCore.Relational/Properties/RelationalStrings.resx b/src/EFCore.Relational/Properties/RelationalStrings.resx index 2f2b19d4476..dbfed868cf7 100644 --- a/src/EFCore.Relational/Properties/RelationalStrings.resx +++ b/src/EFCore.Relational/Properties/RelationalStrings.resx @@ -292,6 +292,21 @@ Either {param1} or {param2} must be null. + + An error occurred while reading a database value for property '{entityType}.{property}'. See the inner exception for more information. + + + An error occurred while reading a database value for property '{entityType}.{property}'. The expected type was '{expectedType}' but the actual value was null. + + + An error occurred while reading a database value. See the inner exception for more information. + + + An error occurred while reading a database value. The expected type was '{expectedType}' but the actual value was of type '{actualType}'. + + + An error occurred while reading a database value. The expected type was '{expectedType}' but the actual value was null. + The required column '{column}' was not present in the results of a 'FromSql' operation. diff --git a/src/EFCore.Relational/Query/Internal/BufferedDataReader.cs b/src/EFCore.Relational/Query/Internal/BufferedDataReader.cs index 6f0cdfb9090..19984aa1817 100644 --- a/src/EFCore.Relational/Query/Internal/BufferedDataReader.cs +++ b/src/EFCore.Relational/Query/Internal/BufferedDataReader.cs @@ -1884,19 +1884,19 @@ private static void ThrowReadValueException( message = exception is NullReferenceException || Equals(value, DBNull.Value) - ? CoreStrings.ErrorMaterializingPropertyNullReference(entityType, propertyName, expectedType) + ? RelationalStrings.ErrorMaterializingPropertyNullReference(entityType, propertyName, expectedType) : exception is InvalidCastException ? CoreStrings.ErrorMaterializingPropertyInvalidCast(entityType, propertyName, expectedType, actualType) - : CoreStrings.ErrorMaterializingProperty(entityType, propertyName); + : RelationalStrings.ErrorMaterializingProperty(entityType, propertyName); } else { message = exception is NullReferenceException || Equals(value, DBNull.Value) - ? CoreStrings.ErrorMaterializingValueNullReference(expectedType) + ? RelationalStrings.ErrorMaterializingValueNullReference(expectedType) : exception is InvalidCastException - ? CoreStrings.ErrorMaterializingValueInvalidCast(expectedType, actualType) - : CoreStrings.ErrorMaterializingValue; + ? RelationalStrings.ErrorMaterializingValueInvalidCast(expectedType, actualType) + : RelationalStrings.ErrorMaterializingValue; } throw new InvalidOperationException(message, exception); diff --git a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs index 02106f812cc..cce1f452601 100644 --- a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs +++ b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs @@ -1096,19 +1096,19 @@ private static TValue ThrowReadValueException( message = exception is NullReferenceException || Equals(value, DBNull.Value) - ? CoreStrings.ErrorMaterializingPropertyNullReference(entityType, propertyName, expectedType) + ? RelationalStrings.ErrorMaterializingPropertyNullReference(entityType, propertyName, expectedType) : exception is InvalidCastException ? CoreStrings.ErrorMaterializingPropertyInvalidCast(entityType, propertyName, expectedType, actualType) - : CoreStrings.ErrorMaterializingProperty(entityType, propertyName); + : RelationalStrings.ErrorMaterializingProperty(entityType, propertyName); } else { message = exception is NullReferenceException || Equals(value, DBNull.Value) - ? CoreStrings.ErrorMaterializingValueNullReference(expectedType) + ? RelationalStrings.ErrorMaterializingValueNullReference(expectedType) : exception is InvalidCastException - ? CoreStrings.ErrorMaterializingValueInvalidCast(expectedType, actualType) - : CoreStrings.ErrorMaterializingValue; + ? RelationalStrings.ErrorMaterializingValueInvalidCast(expectedType, actualType) + : RelationalStrings.ErrorMaterializingValue; } throw new InvalidOperationException(message, exception); diff --git a/src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs b/src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs index 2530c390a0a..9d1b2c652ca 100644 --- a/src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs +++ b/src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs @@ -330,7 +330,8 @@ protected override Expression VisitBinary(BinaryExpression binaryExpression) if ((binaryExpression.NodeType == ExpressionType.Equal || binaryExpression.NodeType == ExpressionType.NotEqual) // Visited expression could be null, We need to pass MemberInitExpression - && TryRewriteEntityEquality(binaryExpression.NodeType, visitedLeft ?? left, visitedRight ?? right, out var result)) + && TryRewriteEntityEquality( + binaryExpression.NodeType, visitedLeft ?? left, visitedRight ?? right, equalsMethod: false, out var result)) { return result; } @@ -734,6 +735,7 @@ static bool IsAggregateResultWithCustomShaper(MethodInfo method) ExpressionType.Equal, left ?? methodCallExpression.Object, right ?? methodCallExpression.Arguments[0], + equalsMethod: true, out var result)) { return result; @@ -769,6 +771,7 @@ static bool IsAggregateResultWithCustomShaper(MethodInfo method) ExpressionType.Equal, left ?? methodCallExpression.Arguments[0], right ?? methodCallExpression.Arguments[1], + equalsMethod: true, out var result)) { return result; @@ -1183,13 +1186,14 @@ private bool TryRewriteContainsEntity(Expression source, Expression item, out Ex var primaryKeyProperties = entityType.FindPrimaryKey()?.Properties; if (primaryKeyProperties == null) { - throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported(entityType.DisplayName())); + throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported( + nameof(Queryable.Contains), entityType.DisplayName())); } if (primaryKeyProperties.Count > 1) { throw new InvalidOperationException( - CoreStrings.EntityEqualityContainsWithCompositeKeyNotSupported(entityType.DisplayName())); + CoreStrings.EntityEqualityOnCompositeKeyEntitySubqueryNotSupported(nameof(Queryable.Contains), entityType.DisplayName())); } var property = primaryKeyProperties[0]; @@ -1222,7 +1226,7 @@ when sqlParameterExpression.Name.StartsWith(QueryCompilationContext.QueryParamet var newParameterName = $"{RuntimeParameterPrefix}" - + $"{sqlParameterExpression.Name.Substring(QueryCompilationContext.QueryParameterPrefix.Length)}_{property.Name}"; + + $"{sqlParameterExpression.Name[QueryCompilationContext.QueryParameterPrefix.Length..]}_{property.Name}"; rewrittenSource = _queryCompilationContext.RegisterRuntimeParameter(newParameterName, lambda); break; @@ -1240,7 +1244,7 @@ when sqlParameterExpression.Name.StartsWith(QueryCompilationContext.QueryParamet return true; } - private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left, Expression right, out Expression result) + private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left, Expression right, bool equalsMethod, out Expression result) { var leftEntityReference = left as EntityReferenceExpression; var rightEntityReference = right as EntityReferenceExpression; @@ -1310,7 +1314,11 @@ private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left, var primaryKeyProperties1 = entityType1.FindPrimaryKey()?.Properties; if (primaryKeyProperties1 == null) { - throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported(entityType1.DisplayName())); + throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported( + nodeType == ExpressionType.Equal + ? equalsMethod ? nameof(object.Equals) : "==" + : equalsMethod ? "!" + nameof(object.Equals) : "!=", + entityType1.DisplayName())); } result = Visit( @@ -1347,15 +1355,22 @@ private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left, var primaryKeyProperties = entityType.FindPrimaryKey()?.Properties; if (primaryKeyProperties == null) { - throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported(entityType.DisplayName())); + throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported( + nodeType == ExpressionType.Equal + ? equalsMethod ? nameof(object.Equals) : "==" + : equalsMethod ? "!" + nameof(object.Equals) : "!=", + entityType.DisplayName())); } if (primaryKeyProperties.Count > 1 && (leftEntityReference?.SubqueryEntity != null || rightEntityReference?.SubqueryEntity != null)) { - throw new InvalidOperationException( - CoreStrings.EntityEqualitySubqueryWithCompositeKeyNotSupported(entityType.DisplayName())); + throw new InvalidOperationException(CoreStrings.EntityEqualityOnCompositeKeyEntitySubqueryNotSupported( + nodeType == ExpressionType.Equal + ? equalsMethod ? nameof(object.Equals) : "==" + : equalsMethod ? "!" + nameof(object.Equals) : "!=", + entityType.DisplayName())); } result = Visit( diff --git a/src/EFCore.Relational/Storage/TypedRelationalValueBufferFactoryFactory.cs b/src/EFCore.Relational/Storage/TypedRelationalValueBufferFactoryFactory.cs index 6014c101764..8b7d18aecf4 100644 --- a/src/EFCore.Relational/Storage/TypedRelationalValueBufferFactoryFactory.cs +++ b/src/EFCore.Relational/Storage/TypedRelationalValueBufferFactoryFactory.cs @@ -168,19 +168,19 @@ private static TValue ThrowReadValueException( message = exception is NullReferenceException || Equals(value, DBNull.Value) - ? CoreStrings.ErrorMaterializingPropertyNullReference(entityType, propertyName, expectedType) + ? RelationalStrings.ErrorMaterializingPropertyNullReference(entityType, propertyName, expectedType) : exception is InvalidCastException ? CoreStrings.ErrorMaterializingPropertyInvalidCast(entityType, propertyName, expectedType, actualType) - : CoreStrings.ErrorMaterializingProperty(entityType, propertyName); + : RelationalStrings.ErrorMaterializingProperty(entityType, propertyName); } else { message = exception is NullReferenceException - ? CoreStrings.ErrorMaterializingValueNullReference(expectedType) + ? RelationalStrings.ErrorMaterializingValueNullReference(expectedType) : exception is InvalidCastException - ? CoreStrings.ErrorMaterializingValueInvalidCast(expectedType, actualType) - : CoreStrings.ErrorMaterializingValue; + ? RelationalStrings.ErrorMaterializingValueInvalidCast(expectedType, actualType) + : RelationalStrings.ErrorMaterializingValue; } throw new InvalidOperationException(message, exception); diff --git a/src/EFCore/Properties/CoreStrings.Designer.cs b/src/EFCore/Properties/CoreStrings.Designer.cs index 2a5e9837c36..96e9c1f177e 100644 --- a/src/EFCore/Properties/CoreStrings.Designer.cs +++ b/src/EFCore/Properties/CoreStrings.Designer.cs @@ -199,7 +199,7 @@ public static string CannotBeNullablePK([CanBeNull] object property, [CanBeNull] property, entityType); /// - /// Unable to convert queryable method to enumerable method. This is likely an issue in EF Core, please report it. + /// Unable to convert queryable method to enumerable method. This is likely an issue in EF Core, please file an issue at https://go.microsoft.com/fwlink/?linkid=2142044. /// public static string CannotConvertQueryableToEnumerableMethod => GetString("CannotConvertQueryableToEnumerableMethod"); @@ -473,7 +473,7 @@ public static string ContextDisposed => GetString("ContextDisposed"); /// - /// The convention invocations have reached the recursion limit. This is likely an issue in Entity Framework, please report it. + /// The convention invocations have reached the recursion limit. This is likely an issue in EF Core, please file an issue at https://go.microsoft.com/fwlink/?linkid=2142044. /// public static string ConventionsInfiniteLoop => GetString("ConventionsInfiniteLoop"); @@ -699,31 +699,23 @@ public static string DuplicateServicePropertyType([CanBeNull] object property, [ property, serviceType, entityType, duplicateName, duplicateEntityType); /// - /// Cannot translate a 'Contains' operator on entity '{entityType}' because it has a composite key. + /// Cannot translate the '{comparisonOperator}' on a subquery expression of entity type '{entityType}' because it has a composite primary key. See https://go.microsoft.com/fwlink/?linkid=2141942 for information on how to rewrite your query. /// - public static string EntityEqualityContainsWithCompositeKeyNotSupported([CanBeNull] object entityType) + public static string EntityEqualityOnCompositeKeyEntitySubqueryNotSupported([CanBeNull] object comparisonOperator, [CanBeNull] object entityType) => string.Format( - GetString("EntityEqualityContainsWithCompositeKeyNotSupported", nameof(entityType)), - entityType); + GetString("EntityEqualityOnCompositeKeyEntitySubqueryNotSupported", nameof(comparisonOperator), nameof(entityType)), + comparisonOperator, entityType); /// - /// Comparison on entity type '{entityType}' is not supported because it is a keyless entity. + /// Cannot translate the '{comparisonOperator}' on an expression of entity type '{entityType}' because it is a keyless entity. Consider using entity properties instead. /// - public static string EntityEqualityOnKeylessEntityNotSupported([CanBeNull] object entityType) + public static string EntityEqualityOnKeylessEntityNotSupported([CanBeNull] object comparisonOperator, [CanBeNull] object entityType) => string.Format( - GetString("EntityEqualityOnKeylessEntityNotSupported", nameof(entityType)), - entityType); - - /// - /// This query would cause multiple evaluation of a subquery because entity '{entityType}' has a composite key. Rewrite your query avoiding the subquery. - /// - public static string EntityEqualitySubqueryWithCompositeKeyNotSupported([CanBeNull] object entityType) - => string.Format( - GetString("EntityEqualitySubqueryWithCompositeKeyNotSupported", nameof(entityType)), - entityType); + GetString("EntityEqualityOnKeylessEntityNotSupported", nameof(comparisonOperator), nameof(entityType)), + comparisonOperator, entityType); /// - /// The entity type '{entityType}' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey' in 'OnModelCreating'. + /// The entity type '{entityType}' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey' in 'OnModelCreating'. For more information on keyless entity types, see https://go.microsoft.com/fwlink/?linkid=2141943. /// public static string EntityRequiresKey([CanBeNull] object entityType) => string.Format( @@ -800,14 +792,6 @@ public static string EntityTypesNotInRelationship([CanBeNull] object invalidDepe public static string ErrorInvalidQueryable => GetString("ErrorInvalidQueryable"); - /// - /// An error occurred while reading a database value for property '{entityType}.{property}'. See the inner exception for more information. - /// - public static string ErrorMaterializingProperty([CanBeNull] object entityType, [CanBeNull] object property) - => string.Format( - GetString("ErrorMaterializingProperty", nameof(entityType), nameof(property)), - entityType, property); - /// /// An error occurred while reading a database value for property '{entityType}.{property}'. The expected type was '{expectedType}' but the actual value was of type '{actualType}'. /// @@ -816,36 +800,6 @@ public static string ErrorMaterializingPropertyInvalidCast([CanBeNull] object en GetString("ErrorMaterializingPropertyInvalidCast", nameof(entityType), nameof(property), nameof(expectedType), nameof(actualType)), entityType, property, expectedType, actualType); - /// - /// An error occurred while reading a database value for property '{entityType}.{property}'. The expected type was '{expectedType}' but the actual value was null. - /// - public static string ErrorMaterializingPropertyNullReference([CanBeNull] object entityType, [CanBeNull] object property, [CanBeNull] object expectedType) - => string.Format( - GetString("ErrorMaterializingPropertyNullReference", nameof(entityType), nameof(property), nameof(expectedType)), - entityType, property, expectedType); - - /// - /// An error occurred while reading a database value. See the inner exception for more information. - /// - public static string ErrorMaterializingValue - => GetString("ErrorMaterializingValue"); - - /// - /// An error occurred while reading a database value. The expected type was '{expectedType}' but the actual value was of type '{actualType}'. - /// - public static string ErrorMaterializingValueInvalidCast([CanBeNull] object expectedType, [CanBeNull] object actualType) - => string.Format( - GetString("ErrorMaterializingValueInvalidCast", nameof(expectedType), nameof(actualType)), - expectedType, actualType); - - /// - /// An error occurred while reading a database value. The expected type was '{expectedType}' but the actual value was null. - /// - public static string ErrorMaterializingValueNullReference([CanBeNull] object expectedType) - => string.Format( - GetString("ErrorMaterializingValueNullReference", nameof(expectedType)), - expectedType); - /// /// The configured execution strategy '{strategy}' does not support user initiated transactions. Use the execution strategy returned by '{getExecutionStrategyMethod}' to execute all the operations in the transaction as a retriable unit. /// diff --git a/src/EFCore/Properties/CoreStrings.resx b/src/EFCore/Properties/CoreStrings.resx index a9fcf5e82f0..f328d81a288 100644 --- a/src/EFCore/Properties/CoreStrings.resx +++ b/src/EFCore/Properties/CoreStrings.resx @@ -184,7 +184,7 @@ The property '{1_entityType}.{0_property}' cannot be marked as nullable/optional because the property is a part of a key. Any property can be marked as non-nullable/required, but only properties of nullable types and which are not part of a key can be marked as nullable/optional. - Unable to convert queryable method to enumerable method. This is likely an issue in EF Core, please report it. + Unable to convert queryable method to enumerable method. This is likely an issue in EF Core, please file an issue at https://go.microsoft.com/fwlink/?linkid=2142044. Cannot create instance of value generator type '{generatorType}'. Ensure that the type is instantiable and has a parameterless constructor, or use the overload of HasValueGenerator that accepts a delegate. @@ -289,7 +289,7 @@ Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances. - The convention invocations have reached the recursion limit. This is likely an issue in Entity Framework, please report it. + The convention invocations have reached the recursion limit. This is likely an issue in EF Core, please file an issue at https://go.microsoft.com/fwlink/?linkid=2142044. The value converter '{converter}' cannot be used with type '{type}'. This converter can only be used with {allowed}. @@ -375,17 +375,14 @@ The service property '{property}' of type '{serviceType}' cannot be added to the entity type '{entityType}' because service property '{duplicateName}' of the same type already exists on entity type '{duplicateEntityType}'. - - Cannot translate a 'Contains' operator on entity '{entityType}' because it has a composite key. + + Cannot translate the '{comparisonOperator}' on a subquery expression of entity type '{entityType}' because it has a composite primary key. See https://go.microsoft.com/fwlink/?linkid=2141942 for information on how to rewrite your query. - Comparison on entity type '{entityType}' is not supported because it is a keyless entity. - - - This query would cause multiple evaluation of a subquery because entity '{entityType}' has a composite key. Rewrite your query avoiding the subquery. + Cannot translate the '{comparisonOperator}' on an expression of entity type '{entityType}' because it is a keyless entity. Consider using entity properties instead. - The entity type '{entityType}' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey' in 'OnModelCreating'. + The entity type '{entityType}' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey' in 'OnModelCreating'. For more information on keyless entity types, see https://go.microsoft.com/fwlink/?linkid=2141943. The entity type '{entityType}' cannot be removed because '{derivedEntityType}' is derived from it. Before the entity type can be removed, all derived entity types must be removed or configured to use a different base entity type. @@ -414,24 +411,9 @@ Cannot use multiple context instances within a single query execution. Ensure the query uses a single context instance. - - An error occurred while reading a database value for property '{entityType}.{property}'. See the inner exception for more information. - An error occurred while reading a database value for property '{entityType}.{property}'. The expected type was '{expectedType}' but the actual value was of type '{actualType}'. - - An error occurred while reading a database value for property '{entityType}.{property}'. The expected type was '{expectedType}' but the actual value was null. - - - An error occurred while reading a database value. See the inner exception for more information. - - - An error occurred while reading a database value. The expected type was '{expectedType}' but the actual value was of type '{actualType}'. - - - An error occurred while reading a database value. The expected type was '{expectedType}' but the actual value was null. - The configured execution strategy '{strategy}' does not support user initiated transactions. Use the execution strategy returned by '{getExecutionStrategyMethod}' to execute all the operations in the transaction as a retriable unit. diff --git a/src/EFCore/Storage/ValueConversion/ValueConverter.cs b/src/EFCore/Storage/ValueConversion/ValueConverter.cs index e49a430513e..4c71b1387f7 100644 --- a/src/EFCore/Storage/ValueConversion/ValueConverter.cs +++ b/src/EFCore/Storage/ValueConversion/ValueConverter.cs @@ -112,7 +112,7 @@ protected static Type CheckTypeSupported( CoreStrings.ConverterBadType( converterType.ShortDisplayName(), type.ShortDisplayName(), - string.Join(", ", supportedTypes.Select(t => t.ShortDisplayName())))); + string.Join(", ", supportedTypes.Select(t => $"'{t.ShortDisplayName()}'")))); } return type; diff --git a/test/EFCore.Relational.Specification.Tests/Query/FromSqlQueryTestBase.cs b/test/EFCore.Relational.Specification.Tests/Query/FromSqlQueryTestBase.cs index 0af741e9585..df0f2e7b1e2 100644 --- a/test/EFCore.Relational.Specification.Tests/Query/FromSqlQueryTestBase.cs +++ b/test/EFCore.Relational.Specification.Tests/Query/FromSqlQueryTestBase.cs @@ -67,7 +67,7 @@ public virtual void Bad_data_error_handling_invalid_cast_projection() { using var context = CreateContext(); Assert.Equal( - CoreStrings.ErrorMaterializingValueInvalidCast(typeof(decimal?), typeof(int)), + RelationalStrings.ErrorMaterializingValueInvalidCast(typeof(decimal?), typeof(int)), Assert.Throws( () => context.Set().FromSqlRaw( @@ -99,7 +99,7 @@ public virtual void Bad_data_error_handling_null() { using var context = CreateContext(); Assert.Equal( - CoreStrings.ErrorMaterializingPropertyNullReference("Product", "Discontinued", typeof(bool)), + RelationalStrings.ErrorMaterializingPropertyNullReference("Product", "Discontinued", typeof(bool)), Assert.Throws( () => context.Set().FromSqlRaw( @@ -114,7 +114,7 @@ public virtual void Bad_data_error_handling_null_projection() { using var context = CreateContext(); Assert.Equal( - CoreStrings.ErrorMaterializingValueNullReference(typeof(bool)), + RelationalStrings.ErrorMaterializingValueNullReference(typeof(bool)), Assert.Throws( () => context.Set().FromSqlRaw( @@ -130,7 +130,7 @@ public virtual void Bad_data_error_handling_null_no_tracking() { using var context = CreateContext(); Assert.Equal( - CoreStrings.ErrorMaterializingPropertyNullReference("Product", "Discontinued", typeof(bool)), + RelationalStrings.ErrorMaterializingPropertyNullReference("Product", "Discontinued", typeof(bool)), Assert.Throws( () => context.Set() diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs index d78179e89ea..d8ac380d0b6 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs @@ -457,7 +457,7 @@ public void Query_when_null_key_in_database_should_throw() using var context = new NullKeyContext(options); Assert.Equal( - CoreStrings.ErrorMaterializingPropertyNullReference("ZeroKey", "Id", typeof(int)), + RelationalStrings.ErrorMaterializingPropertyNullReference("ZeroKey", "Id", typeof(int)), Assert.Throws(() => context.ZeroKeys.ToList()).Message); } diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/BadDataSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/BadDataSqliteTest.cs index df5b8052641..537313ef181 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/BadDataSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/BadDataSqliteTest.cs @@ -43,7 +43,7 @@ public void Bad_data_error_handling_null_key() { using var context = CreateContext(null, true); Assert.Equal( - CoreStrings.ErrorMaterializingPropertyNullReference("Product", "ProductID", typeof(int)), + RelationalStrings.ErrorMaterializingPropertyNullReference("Product", "ProductID", typeof(int)), Assert.Throws( () => context.Set().Where(p => p.ProductID != 2).ToList()).Message); @@ -65,7 +65,7 @@ public void Bad_data_error_handling_invalid_cast_projection() { using var context = CreateContext(1); Assert.Equal( - CoreStrings.ErrorMaterializingValueInvalidCast(typeof(string), typeof(int)), + RelationalStrings.ErrorMaterializingValueInvalidCast(typeof(string), typeof(int)), Assert.Throws( () => context.Set().Where(p => p.ProductID != 4) @@ -92,7 +92,7 @@ public void Bad_data_error_handling_null() { using var context = CreateContext(1, null); Assert.Equal( - CoreStrings.ErrorMaterializingPropertyNullReference("Product", "Discontinued", typeof(bool)), + RelationalStrings.ErrorMaterializingPropertyNullReference("Product", "Discontinued", typeof(bool)), Assert.Throws( () => context.Set().Where(p => p.ProductID != 6).ToList()).Message); @@ -103,7 +103,7 @@ public void Bad_data_error_handling_null_projection() { using var context = CreateContext(new object[] { null }); Assert.Equal( - CoreStrings.ErrorMaterializingValueNullReference(typeof(bool)), + RelationalStrings.ErrorMaterializingValueNullReference(typeof(bool)), Assert.Throws( () => context.Set() @@ -117,7 +117,7 @@ public void Bad_data_error_handling_null_no_tracking() { using var context = CreateContext(null, true); Assert.Equal( - CoreStrings.ErrorMaterializingPropertyNullReference("Product", "ProductID", typeof(int)), + RelationalStrings.ErrorMaterializingPropertyNullReference("Product", "ProductID", typeof(int)), Assert.Throws( () => context.Set() diff --git a/test/EFCore.Tests/Storage/EnumToNumberConverterTest.cs b/test/EFCore.Tests/Storage/EnumToNumberConverterTest.cs index 00ea03ec985..df1468d5788 100644 --- a/test/EFCore.Tests/Storage/EnumToNumberConverterTest.cs +++ b/test/EFCore.Tests/Storage/EnumToNumberConverterTest.cs @@ -288,7 +288,7 @@ public void Enum_to_integer_converter_throws_for_bad_types() CoreStrings.ConverterBadType( typeof(EnumToNumberConverter).ShortDisplayName(), "Guid", - "int, long, short, byte, uint, ulong, ushort, sbyte, double, float, decimal"), + "'int', 'long', 'short', 'byte', 'uint', 'ulong', 'ushort', 'sbyte', 'double', 'float', 'decimal'"), Assert.Throws( () => new EnumToNumberConverter()).Message); } diff --git a/test/EFCore.Tests/Storage/NumberToBytesConverterTest.cs b/test/EFCore.Tests/Storage/NumberToBytesConverterTest.cs index ccb8274c7a8..14f421ed87b 100644 --- a/test/EFCore.Tests/Storage/NumberToBytesConverterTest.cs +++ b/test/EFCore.Tests/Storage/NumberToBytesConverterTest.cs @@ -505,7 +505,7 @@ public void Enum_to_integer_converter_throws_for_bad_types() CoreStrings.ConverterBadType( "NumberToBytesConverter", "Guid", - "double, float, decimal, char, int, long, short, byte, uint, ulong, ushort, sbyte"), + "'double', 'float', 'decimal', 'char', 'int', 'long', 'short', 'byte', 'uint', 'ulong', 'ushort', 'sbyte'"), Assert.Throws( () => new NumberToBytesConverter()).Message); } diff --git a/test/EFCore.Tests/Storage/NumberToStringConverterTest.cs b/test/EFCore.Tests/Storage/NumberToStringConverterTest.cs index b24a268b984..39514fb2ac0 100644 --- a/test/EFCore.Tests/Storage/NumberToStringConverterTest.cs +++ b/test/EFCore.Tests/Storage/NumberToStringConverterTest.cs @@ -580,7 +580,7 @@ public void Integer_to_string_converter_throws_for_bad_type() CoreStrings.ConverterBadType( typeof(StringNumberConverter).ShortDisplayName(), "Guid", - "int, long, short, byte, uint, ulong, ushort, sbyte, decimal, float, double"), + "'int', 'long', 'short', 'byte', 'uint', 'ulong', 'ushort', 'sbyte', 'decimal', 'float', 'double'"), Assert.Throws( () => new NumberToStringConverter()).Message); } diff --git a/test/EFCore.Tests/Storage/StringToNumberConverterTest.cs b/test/EFCore.Tests/Storage/StringToNumberConverterTest.cs index 671811c7e6f..61261bb11aa 100644 --- a/test/EFCore.Tests/Storage/StringToNumberConverterTest.cs +++ b/test/EFCore.Tests/Storage/StringToNumberConverterTest.cs @@ -580,7 +580,7 @@ public void String_to_integer_converter_throws_for_bad_type() CoreStrings.ConverterBadType( typeof(StringNumberConverter).ShortDisplayName(), "Guid", - "int, long, short, byte, uint, ulong, ushort, sbyte, decimal, float, double"), + "'int', 'long', 'short', 'byte', 'uint', 'ulong', 'ushort', 'sbyte', 'decimal', 'float', 'double'"), Assert.Throws( () => new StringToNumberConverter()).Message); } From a7aed8f6308f5545aa97883d366c0d5ab94ccbd5 Mon Sep 17 00:00:00 2001 From: Smit Patel Date: Thu, 3 Sep 2020 11:56:17 -0700 Subject: [PATCH 2/2] Update EF/EF Core to Entity Framework in resources Part of #7201 --- .../Properties/DesignStrings.Designer.cs | 2 +- .../Properties/DesignStrings.resx | 2 +- .../Properties/RelationalStrings.Designer.cs | 8 ++++---- .../Properties/RelationalStrings.resx | 8 ++++---- .../Properties/SqlServerStrings.Designer.cs | 4 ++-- .../Properties/SqlServerStrings.resx | 4 ++-- src/EFCore/Properties/CoreStrings.Designer.cs | 20 +++++++++---------- src/EFCore/Properties/CoreStrings.resx | 20 +++++++++---------- .../Properties/Resources.Designer.cs | 2 +- src/dotnet-ef/Properties/Resources.resx | 2 +- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/EFCore.Design/Properties/DesignStrings.Designer.cs b/src/EFCore.Design/Properties/DesignStrings.Designer.cs index 85bbe3262e3..d5363ca3558 100644 --- a/src/EFCore.Design/Properties/DesignStrings.Designer.cs +++ b/src/EFCore.Design/Properties/DesignStrings.Designer.cs @@ -619,7 +619,7 @@ public static string UsingReferencedServices([CanBeNull] object referencedAssemb referencedAssembly); /// - /// The EF Core tools version '{toolsVersion}' is older than that of the runtime '{runtimeVersion}'. Update the tools for the latest features and bug fixes. + /// The Entity Framework tools version '{toolsVersion}' is older than that of the runtime '{runtimeVersion}'. Update the tools for the latest features and bug fixes. /// public static string VersionMismatch([CanBeNull] object toolsVersion, [CanBeNull] object runtimeVersion) => string.Format( diff --git a/src/EFCore.Design/Properties/DesignStrings.resx b/src/EFCore.Design/Properties/DesignStrings.resx index 88df94c5ad4..3a36f2c1960 100644 --- a/src/EFCore.Design/Properties/DesignStrings.resx +++ b/src/EFCore.Design/Properties/DesignStrings.resx @@ -361,7 +361,7 @@ Change your target project to the migrations project by using the Package Manage Using design-time services from assembly '{referencedAssembly}'. - The EF Core tools version '{toolsVersion}' is older than that of the runtime '{runtimeVersion}'. Update the tools for the latest features and bug fixes. + The Entity Framework tools version '{toolsVersion}' is older than that of the runtime '{runtimeVersion}'. Update the tools for the latest features and bug fixes. Writing migration to '{file}'. diff --git a/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs b/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs index c42d0acb7ca..51861e4f534 100644 --- a/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs +++ b/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs @@ -49,7 +49,7 @@ public static string ClientGroupByNotSupported => GetString("ClientGroupByNotSupported"); /// - /// The column '{column}' on table '{table}' has unspecified computed column SQL. Specify the SQL before using EF Core to create the database schema. + /// The column '{column}' on table '{table}' has unspecified computed column SQL. Specify the SQL before using Entity Framework to create the database schema. /// public static string ComputedColumnSqlUnspecified([CanBeNull] object column, [CanBeNull] object table) => string.Format( @@ -235,7 +235,7 @@ public static string DbFunctionTableValuedCustomTranslation([CanBeNull] object f function); /// - /// The column '{column}' on table '{table}' has unspecified default value SQL. Specify the SQL before using EF Core to create the database schema. + /// The column '{column}' on table '{table}' has unspecified default value SQL. Specify the SQL before using Entity Framework to create the database schema. /// public static string DefaultValueSqlUnspecified([CanBeNull] object column, [CanBeNull] object table) => string.Format( @@ -243,7 +243,7 @@ public static string DefaultValueSqlUnspecified([CanBeNull] object column, [CanB column, table); /// - /// The column '{column}' on table '{table}' has an unspecified default value. Specify a value before using EF Core to create the database schema. + /// The column '{column}' on table '{table}' has an unspecified default value. Specify a value before using Entity Framework to create the database schema. /// public static string DefaultValueUnspecified([CanBeNull] object column, [CanBeNull] object table) => string.Format( @@ -1967,7 +1967,7 @@ public static EventDefinition LogMigrationAttributeMissingWarning([NotNu } /// - /// Compiling a query which loads related collections for more than one collection navigation either via 'Include' or through projection but no 'QuerySplittingBehavior' has been configured. By default EF Core will use 'QuerySplittingBehavior.SingleQuery' which can potentially result in slow query performance. See https://go.microsoft.com/fwlink/?linkid=2134277 for more information. To identify the query that's triggering this warning call 'ConfigureWarnings(w => w.Throw(RelationalEventId.MultipleCollectionIncludeWarning))' + /// Compiling a query which loads related collections for more than one collection navigation either via 'Include' or through projection but no 'QuerySplittingBehavior' has been configured. By default Entity Framework will use 'QuerySplittingBehavior.SingleQuery' which can potentially result in slow query performance. See https://go.microsoft.com/fwlink/?linkid=2134277 for more information. To identify the query that's triggering this warning call 'ConfigureWarnings(w => w.Throw(RelationalEventId.MultipleCollectionIncludeWarning))' /// public static EventDefinition LogMultipleCollectionIncludeWarning([NotNull] IDiagnosticsLogger logger) { diff --git a/src/EFCore.Relational/Properties/RelationalStrings.resx b/src/EFCore.Relational/Properties/RelationalStrings.resx index dbfed868cf7..0d52bb852c3 100644 --- a/src/EFCore.Relational/Properties/RelationalStrings.resx +++ b/src/EFCore.Relational/Properties/RelationalStrings.resx @@ -130,7 +130,7 @@ The given GroupBy pattern is not translatable. Call AsEnumerable before GroupBy to evaluate it locally. - The column '{column}' on table '{table}' has unspecified computed column SQL. Specify the SQL before using EF Core to create the database schema. + The column '{column}' on table '{table}' has unspecified computed column SQL. Specify the SQL before using Entity Framework to create the database schema. An ambient transaction has been detected. The ambient transaction needs to be completed before beginning a transaction on this connection. @@ -202,10 +202,10 @@ Cannot set custom translation on the DbFunction '{function}' since it is a table valued function. - The column '{column}' on table '{table}' has unspecified default value SQL. Specify the SQL before using EF Core to create the database schema. + The column '{column}' on table '{table}' has unspecified default value SQL. Specify the SQL before using Entity Framework to create the database schema. - The column '{column}' on table '{table}' has an unspecified default value. Specify a value before using EF Core to create the database schema. + The column '{column}' on table '{table}' has an unspecified default value. Specify a value before using Entity Framework to create the database schema. The data deletion operation on '{table}' is not associated with a model. Either add a model to the migration or specify the column types in all data operations. @@ -514,7 +514,7 @@ Warning RelationalEventId.MigrationAttributeMissingWarning string - Compiling a query which loads related collections for more than one collection navigation either via 'Include' or through projection but no 'QuerySplittingBehavior' has been configured. By default EF Core will use 'QuerySplittingBehavior.SingleQuery' which can potentially result in slow query performance. See https://go.microsoft.com/fwlink/?linkid=2134277 for more information. To identify the query that's triggering this warning call 'ConfigureWarnings(w => w.Throw(RelationalEventId.MultipleCollectionIncludeWarning))' + Compiling a query which loads related collections for more than one collection navigation either via 'Include' or through projection but no 'QuerySplittingBehavior' has been configured. By default Entity Framework will use 'QuerySplittingBehavior.SingleQuery' which can potentially result in slow query performance. See https://go.microsoft.com/fwlink/?linkid=2134277 for more information. To identify the query that's triggering this warning call 'ConfigureWarnings(w => w.Throw(RelationalEventId.MultipleCollectionIncludeWarning))' Warning RelationalEventId.MultipleCollectionIncludeWarning diff --git a/src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs b/src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs index 518a34ad9de..69a7ff296ee 100644 --- a/src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs +++ b/src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs @@ -216,7 +216,7 @@ public static string UnknownOperatorTypeInSqlUnaryExpression => GetString("UnknownOperatorTypeInSqlUnaryExpression"); /// - /// Data type '{dataType}' is not supported in this form. Either specify the length explicitly in the type name, for example as '{dataType}(16)', or remove the data type and use APIs such as HasMaxLength to allow EF choose the data type. + /// Data type '{dataType}' is not supported in this form. Either specify the length explicitly in the type name, for example as '{dataType}(16)', or remove the data type and use APIs such as HasMaxLength to allow Entity Framework choose the data type. /// public static string UnqualifiedDataType([CanBeNull] object dataType) => string.Format( @@ -224,7 +224,7 @@ public static string UnqualifiedDataType([CanBeNull] object dataType) dataType); /// - /// Data type '{dataType}' for property '{property}' is not supported in this form. Either specify the length explicitly in the type name, for example as '{dataType}(16)', or remove the data type and use APIs such as HasMaxLength to allow EF choose the data type. + /// Data type '{dataType}' for property '{property}' is not supported in this form. Either specify the length explicitly in the type name, for example as '{dataType}(16)', or remove the data type and use APIs such as HasMaxLength to allow Entity Framework choose the data type. /// public static string UnqualifiedDataTypeOnProperty([CanBeNull] object dataType, [CanBeNull] object property) => string.Format( diff --git a/src/EFCore.SqlServer/Properties/SqlServerStrings.resx b/src/EFCore.SqlServer/Properties/SqlServerStrings.resx index 9aa26c2776f..bd715339008 100644 --- a/src/EFCore.SqlServer/Properties/SqlServerStrings.resx +++ b/src/EFCore.SqlServer/Properties/SqlServerStrings.resx @@ -268,9 +268,9 @@ Unknown operator type encountered in SqlUnaryExpression. - Data type '{dataType}' is not supported in this form. Either specify the length explicitly in the type name, for example as '{dataType}(16)', or remove the data type and use APIs such as HasMaxLength to allow EF choose the data type. + Data type '{dataType}' is not supported in this form. Either specify the length explicitly in the type name, for example as '{dataType}(16)', or remove the data type and use APIs such as HasMaxLength to allow Entity Framework choose the data type. - Data type '{dataType}' for property '{property}' is not supported in this form. Either specify the length explicitly in the type name, for example as '{dataType}(16)', or remove the data type and use APIs such as HasMaxLength to allow EF choose the data type. + Data type '{dataType}' for property '{property}' is not supported in this form. Either specify the length explicitly in the type name, for example as '{dataType}(16)', or remove the data type and use APIs such as HasMaxLength to allow Entity Framework choose the data type. \ No newline at end of file diff --git a/src/EFCore/Properties/CoreStrings.Designer.cs b/src/EFCore/Properties/CoreStrings.Designer.cs index 96e9c1f177e..1430118e861 100644 --- a/src/EFCore/Properties/CoreStrings.Designer.cs +++ b/src/EFCore/Properties/CoreStrings.Designer.cs @@ -199,7 +199,7 @@ public static string CannotBeNullablePK([CanBeNull] object property, [CanBeNull] property, entityType); /// - /// Unable to convert queryable method to enumerable method. This is likely an issue in EF Core, please file an issue at https://go.microsoft.com/fwlink/?linkid=2142044. + /// Unable to convert queryable method to enumerable method. This is likely an issue in Entity Framework, please file an issue at https://go.microsoft.com/fwlink/?linkid=2142044. /// public static string CannotConvertQueryableToEnumerableMethod => GetString("CannotConvertQueryableToEnumerableMethod"); @@ -473,7 +473,7 @@ public static string ContextDisposed => GetString("ContextDisposed"); /// - /// The convention invocations have reached the recursion limit. This is likely an issue in EF Core, please file an issue at https://go.microsoft.com/fwlink/?linkid=2142044. + /// The convention invocations have reached the recursion limit. This is likely an issue in Entity Framework, please file an issue at https://go.microsoft.com/fwlink/?linkid=2142044. /// public static string ConventionsInfiniteLoop => GetString("ConventionsInfiniteLoop"); @@ -1214,7 +1214,7 @@ public static string InvalidRelationshipUsingDataAnnotations([CanBeNull] object navigation, entityType, referencedNavigation, referencedEntityType); /// - /// A call was made to '{replaceService}', but Entity Framework is not building its own internal service provider. Either allow EF to build the service provider by removing the call to '{useInternalServiceProvider}', or build replacement services into the service provider before passing it to '{useInternalServiceProvider}'. + /// A call was made to '{replaceService}', but Entity Framework is not building its own internal service provider. Either allow Entity Framework to build the service provider by removing the call to '{useInternalServiceProvider}', or build replacement services into the service provider before passing it to '{useInternalServiceProvider}'. /// public static string InvalidReplaceService([CanBeNull] object replaceService, [CanBeNull] object useInternalServiceProvider) => string.Format( @@ -1284,7 +1284,7 @@ public static string InvalidTypeConversationWithInclude => GetString("InvalidTypeConversationWithInclude"); /// - /// A call was made to '{useService}', but Entity Framework is not building its own internal service provider. Either allow EF to build the service provider by removing the call to '{useInternalServiceProvider}', or build the '{service}' services to use into the service provider before passing it to '{useInternalServiceProvider}'. + /// A call was made to '{useService}', but Entity Framework is not building its own internal service provider. Either allow Entity Framework to build the service provider by removing the call to '{useInternalServiceProvider}', or build the '{service}' services to use into the service provider before passing it to '{useInternalServiceProvider}'. /// public static string InvalidUseService([CanBeNull] object useService, [CanBeNull] object useInternalServiceProvider, [CanBeNull] object service) => string.Format( @@ -1666,7 +1666,7 @@ public static string NoDiscriminatorValue([CanBeNull] object entityType) entityType); /// - /// Entity Framework services have not been added to the internal service provider. Either remove the call to 'UseInternalServiceProvider' so that EF will manage its own internal services, or use the method from your database provider to add the required services to the service provider (e.g. 'AddEntityFrameworkSqlServer'). + /// Entity Framework services have not been added to the internal service provider. Either remove the call to 'UseInternalServiceProvider' so that Entity Framework will manage its own internal services, or use the method from your database provider to add the required services to the service provider (e.g. 'AddEntityFrameworkSqlServer'). /// public static string NoEfServices => GetString("NoEfServices"); @@ -1798,7 +1798,7 @@ public static string NonUniqueRequiredDependentNavigation([CanBeNull] object pri principalEntityType, principalNavigation); /// - /// A parameterless constructor was not found on entity type '{entityType}'. In order to create an instance of '{entityType}' EF requires that a parameterless constructor be declared. + /// A parameterless constructor was not found on entity type '{entityType}'. In order to create an instance of '{entityType}' Entity Framework requires that a parameterless constructor be declared. /// public static string NoParameterlessConstructor([CanBeNull] object entityType) => string.Format( @@ -1844,7 +1844,7 @@ public static string NoSetter([CanBeNull] object property, [CanBeNull] object en property, entityType, propertyAccessMode); /// - /// The database provider attempted to register an implementation of the '{service}' service. This is not a service defined by EF and as such must be registered as a provider-specific service using the 'TryAddProviderSpecificServices' method. + /// The database provider attempted to register an implementation of the '{service}' service. This is not a service defined by Entity Framework and as such must be registered as a provider-specific service using the 'TryAddProviderSpecificServices' method. /// public static string NotAnEFService([CanBeNull] object service) => string.Format( @@ -2122,7 +2122,7 @@ public static string QueryEntityMaterializationConditionWrongShape([CanBeNull] o entityType); /// - /// Processing of the LINQ expression '{expression}' by '{visitor}' failed. This may indicate either a bug or a limitation in EF Core. See https://go.microsoft.com/fwlink/?linkid=2101433 for more detailed information. + /// Processing of the LINQ expression '{expression}' by '{visitor}' failed. This may indicate either a bug or a limitation in Entity Framework. See https://go.microsoft.com/fwlink/?linkid=2101433 for more detailed information. /// public static string QueryFailed([CanBeNull] object expression, [CanBeNull] object visitor) => string.Format( @@ -2406,7 +2406,7 @@ public static string SharedTypeDerivedType([CanBeNull] object entityType) entityType); /// - /// A call was made to '{optionCall}' that changed an option that must be constant within a service provider, but Entity Framework is not building its own internal service provider. Either allow EF to build the service provider by removing the call to '{useInternalServiceProvider}', or ensure that the configuration for '{optionCall}' does not change for all uses of a given service provider passed to '{useInternalServiceProvider}'. + /// A call was made to '{optionCall}' that changed an option that must be constant within a service provider, but Entity Framework is not building its own internal service provider. Either allow Entity Framework to build the service provider by removing the call to '{useInternalServiceProvider}', or ensure that the configuration for '{optionCall}' does not change for all uses of a given service provider passed to '{useInternalServiceProvider}'. /// public static string SingletonOptionChanged([CanBeNull] object optionCall, [CanBeNull] object useInternalServiceProvider) => string.Format( @@ -2974,7 +2974,7 @@ public static EventDefinition LogConflictingKeylessAndKeyAttribu } /// - /// There are multiple relationships between '{dependentEntityType}' and '{principalEntityType}' without configured foreign key properties causing EF to create shadow properties on '{dependentType}' with names dependent on the discovery order. + /// There are multiple relationships between '{dependentEntityType}' and '{principalEntityType}' without configured foreign key properties causing Entity Framework to create shadow properties on '{dependentType}' with names dependent on the discovery order. /// public static EventDefinition LogConflictingShadowForeignKeys([NotNull] IDiagnosticsLogger logger) { diff --git a/src/EFCore/Properties/CoreStrings.resx b/src/EFCore/Properties/CoreStrings.resx index f328d81a288..45ab23f6e34 100644 --- a/src/EFCore/Properties/CoreStrings.resx +++ b/src/EFCore/Properties/CoreStrings.resx @@ -184,7 +184,7 @@ The property '{1_entityType}.{0_property}' cannot be marked as nullable/optional because the property is a part of a key. Any property can be marked as non-nullable/required, but only properties of nullable types and which are not part of a key can be marked as nullable/optional. - Unable to convert queryable method to enumerable method. This is likely an issue in EF Core, please file an issue at https://go.microsoft.com/fwlink/?linkid=2142044. + Unable to convert queryable method to enumerable method. This is likely an issue in Entity Framework, please file an issue at https://go.microsoft.com/fwlink/?linkid=2142044. Cannot create instance of value generator type '{generatorType}'. Ensure that the type is instantiable and has a parameterless constructor, or use the overload of HasValueGenerator that accepts a delegate. @@ -289,7 +289,7 @@ Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances. - The convention invocations have reached the recursion limit. This is likely an issue in EF Core, please file an issue at https://go.microsoft.com/fwlink/?linkid=2142044. + The convention invocations have reached the recursion limit. This is likely an issue in Entity Framework, please file an issue at https://go.microsoft.com/fwlink/?linkid=2142044. The value converter '{converter}' cannot be used with type '{type}'. This converter can only be used with {allowed}. @@ -577,7 +577,7 @@ Invalid relationship has been specified using [InverseProperty] attribute and [ForeignKey] attribute. The navigation '{1_entityType}.{0_navigation}' and the navigation '{3_referencedEntityType}.{2_referencedNavigation}' are related by [InverseProperty] attribute but the [ForeignKey] attribute specified for both navigations have different values. - A call was made to '{replaceService}', but Entity Framework is not building its own internal service provider. Either allow EF to build the service provider by removing the call to '{useInternalServiceProvider}', or build replacement services into the service provider before passing it to '{useInternalServiceProvider}'. + A call was made to '{replaceService}', but Entity Framework is not building its own internal service provider. Either allow Entity Framework to build the service provider by removing the call to '{useInternalServiceProvider}', or build replacement services into the service provider before passing it to '{useInternalServiceProvider}'. The invoked method cannot be used for the entity type '{entityType}' because it does not have a primary key. @@ -604,7 +604,7 @@ Invalid type conversion specified in 'Include' call. - A call was made to '{useService}', but Entity Framework is not building its own internal service provider. Either allow EF to build the service provider by removing the call to '{useInternalServiceProvider}', or build the '{service}' services to use into the service provider before passing it to '{useInternalServiceProvider}'. + A call was made to '{useService}', but Entity Framework is not building its own internal service provider. Either allow Entity Framework to build the service provider by removing the call to '{useInternalServiceProvider}', or build the '{service}' services to use into the service provider before passing it to '{useInternalServiceProvider}'. The '{factory}' cannot create a value generator for property '{2_entityType}.{1_property}'. Only integer properties are supported. @@ -695,7 +695,7 @@ Warning CoreEventId.ConflictingKeylessAndKeyAttributesWarning string string - There are multiple relationships between '{dependentEntityType}' and '{principalEntityType}' without configured foreign key properties causing EF to create shadow properties on '{dependentType}' with names dependent on the discovery order. + There are multiple relationships between '{dependentEntityType}' and '{principalEntityType}' without configured foreign key properties causing Entity Framework to create shadow properties on '{dependentType}' with names dependent on the discovery order. Warning CoreEventId.ConflictingShadowForeignKeysWarning string string string @@ -1044,7 +1044,7 @@ The entity type '{entityType}' is part of a hierarchy, but does not have a discriminator value configured. - Entity Framework services have not been added to the internal service provider. Either remove the call to 'UseInternalServiceProvider' so that EF will manage its own internal services, or use the method from your database provider to add the required services to the service provider (e.g. 'AddEntityFrameworkSqlServer'). + Entity Framework services have not been added to the internal service provider. Either remove the call to 'UseInternalServiceProvider' so that Entity Framework will manage its own internal services, or use the method from your database provider to add the required services to the service provider (e.g. 'AddEntityFrameworkSqlServer'). No backing field could be found for property '{1_entityType}.{0_property}' and the property does not have a getter. @@ -1095,7 +1095,7 @@ '{principalEntityType}.{principalNavigation}' cannot be configured as required since it contains a collection. - A parameterless constructor was not found on entity type '{entityType}'. In order to create an instance of '{entityType}' EF requires that a parameterless constructor be declared. + A parameterless constructor was not found on entity type '{entityType}'. In order to create an instance of '{entityType}' Entity Framework requires that a parameterless constructor be declared. No property was associated with field '{field}' of entity type '{entity}'. Either configure a property or use a different '{propertyAccessMode}'. @@ -1113,7 +1113,7 @@ The property '{1_entityType}.{0_property}' does not have a setter. Either make the property writable or use a different '{propertyAccessMode}'. - The database provider attempted to register an implementation of the '{service}' service. This is not a service defined by EF and as such must be registered as a provider-specific service using the 'TryAddProviderSpecificServices' method. + The database provider attempted to register an implementation of the '{service}' service. This is not a service defined by Entity Framework and as such must be registered as a provider-specific service using the 'TryAddProviderSpecificServices' method. The entity type '{entityType}' cannot inherit from '{baseEntityType}' because '{clrType}' is not a descendant of '{baseClrType}'. @@ -1221,7 +1221,7 @@ Materialization condition passed for entity shaper of entity type '{entityType}' is not of correct shape. Materialization condition must be LambdaExpression of 'Func<ValueBuffer, IEntityType>' - Processing of the LINQ expression '{expression}' by '{visitor}' failed. This may indicate either a bug or a limitation in EF Core. See https://go.microsoft.com/fwlink/?linkid=2101433 for more detailed information. + Processing of the LINQ expression '{expression}' by '{visitor}' failed. This may indicate either a bug or a limitation in Entity Framework. See https://go.microsoft.com/fwlink/?linkid=2101433 for more detailed information. The query contains a final projection '{projection}' to type '{queryableType}'. Collections in the final projection must be an 'IEnumerable<T>' type such as 'List<T>'. Consider using 'ToList()' or some other mechanism to convert the 'IQueryable<T>' or 'IOrderedEnumerable<T>' into an 'IEnumerable<T>'. @@ -1335,7 +1335,7 @@ The shared type entity type '{entityType}' cannot have a base type. - A call was made to '{optionCall}' that changed an option that must be constant within a service provider, but Entity Framework is not building its own internal service provider. Either allow EF to build the service provider by removing the call to '{useInternalServiceProvider}', or ensure that the configuration for '{optionCall}' does not change for all uses of a given service provider passed to '{useInternalServiceProvider}'. + A call was made to '{optionCall}' that changed an option that must be constant within a service provider, but Entity Framework is not building its own internal service provider. Either allow Entity Framework to build the service provider by removing the call to '{useInternalServiceProvider}', or ensure that the configuration for '{optionCall}' does not change for all uses of a given service provider passed to '{useInternalServiceProvider}'. An attempt was made to register an instance for the '{scope}' service '{service}'. Instances can only be registered for 'Singleton' services. diff --git a/src/dotnet-ef/Properties/Resources.Designer.cs b/src/dotnet-ef/Properties/Resources.Designer.cs index 600b3472b4a..4e46605f24c 100644 --- a/src/dotnet-ef/Properties/Resources.Designer.cs +++ b/src/dotnet-ef/Properties/Resources.Designer.cs @@ -303,7 +303,7 @@ public static string NETCoreApp1StartupProject([CanBeNull] object startupProject startupProject, targetFrameworkVersion); /// - /// Startup project '{startupProject}' targets framework '.NETStandard'. There is no runtime associated with this framework, and projects targeting it cannot be executed directly. To use the Entity Framework Core .NET Command-line Tools with this project, add an executable project targeting .NET Core or .NET Framework that references this project, and set it as the startup project using --startup-project; or, update this project to cross-target .NET Core or .NET Framework. For more information on using the EF Core Tools with .NET Standard projects, see https://go.microsoft.com/fwlink/?linkid=2034781 + /// Startup project '{startupProject}' targets framework '.NETStandard'. There is no runtime associated with this framework, and projects targeting it cannot be executed directly. To use the Entity Framework Core .NET Command-line Tools with this project, add an executable project targeting .NET Core or .NET Framework that references this project, and set it as the startup project using --startup-project; or, update this project to cross-target .NET Core or .NET Framework. For more information on using the Entity Framework Tools with .NET Standard projects, see https://go.microsoft.com/fwlink/?linkid=2034781 /// public static string NETStandardStartupProject([CanBeNull] object startupProject) => string.Format( diff --git a/src/dotnet-ef/Properties/Resources.resx b/src/dotnet-ef/Properties/Resources.resx index 7e061d6bb15..98b4bfd1bda 100644 --- a/src/dotnet-ef/Properties/Resources.resx +++ b/src/dotnet-ef/Properties/Resources.resx @@ -256,7 +256,7 @@ Startup project '{startupProject}' targets framework '.NETCoreApp' version '{targetFrameworkVersion}'. This version of the Entity Framework Core .NET Command-line Tools only supports version 2.0 or higher. For information on using older versions of the tools, see https://go.microsoft.com/fwlink/?linkid=871254 - Startup project '{startupProject}' targets framework '.NETStandard'. There is no runtime associated with this framework, and projects targeting it cannot be executed directly. To use the Entity Framework Core .NET Command-line Tools with this project, add an executable project targeting .NET Core or .NET Framework that references this project, and set it as the startup project using --startup-project; or, update this project to cross-target .NET Core or .NET Framework. For more information on using the EF Core Tools with .NET Standard projects, see https://go.microsoft.com/fwlink/?linkid=2034781 + Startup project '{startupProject}' targets framework '.NETStandard'. There is no runtime associated with this framework, and projects targeting it cannot be executed directly. To use the Entity Framework Core .NET Command-line Tools with this project, add an executable project targeting .NET Core or .NET Framework that references this project, and set it as the startup project using --startup-project; or, update this project to cross-target .NET Core or .NET Framework. For more information on using the Entity Framework Tools with .NET Standard projects, see https://go.microsoft.com/fwlink/?linkid=2034781 Don't build the project. Only use this when the build is up-to-date.