From 64c4e9e20e3c229420c9ce8aeac33e8409f0c602 Mon Sep 17 00:00:00 2001 From: Smit Patel Date: Wed, 10 Aug 2022 15:26:55 -0700 Subject: [PATCH] Exception message review by Shay --- .../Properties/RelationalStrings.Designer.cs | 212 +++++++++--------- .../Properties/RelationalStrings.resx | 84 +++---- 2 files changed, 148 insertions(+), 148 deletions(-) diff --git a/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs b/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs index 662861998b6..7d1db82e5e9 100644 --- a/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs +++ b/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs @@ -967,6 +967,106 @@ public static string InvalidMinBatchSize(object? value) GetString("InvalidMinBatchSize", nameof(value)), value); + /// + /// Entity '{jsonType}' is mapped to JSON and also to a view '{viewName}', but its owner '{ownerType}' is mapped to a different view '{ownerViewName}'. Every entity mapped to JSON must also map to the same view as its owner. + /// + public static string JsonEntityMappedToDifferentViewThanOwner(object? jsonType, object? viewName, object? ownerType, object? ownerViewName) + => string.Format( + GetString("JsonEntityMappedToDifferentViewThanOwner", nameof(jsonType), nameof(viewName), nameof(ownerType), nameof(ownerViewName)), + jsonType, viewName, ownerType, ownerViewName); + + /// + /// Multiple owned root entities are mapped to the same JSON column '{column}' in table '{table}'. Each owned root entity must map to a different column. + /// + public static string JsonEntityMultipleRootsMappedToTheSameJsonColumn(object? column, object? table) + => string.Format( + GetString("JsonEntityMultipleRootsMappedToTheSameJsonColumn", nameof(column), nameof(table)), + column, table); + + /// + /// Owned entity type '{nonJsonType}' is mapped to table '{table}' and contains JSON columns. This is currently not supported. All owned types containing a JSON column must be mapped to a JSON column themselves. + /// + public static string JsonEntityOwnedByNonJsonOwnedType(object? nonJsonType, object? table) + => string.Format( + GetString("JsonEntityOwnedByNonJsonOwnedType", nameof(nonJsonType), nameof(table)), + nonJsonType, table); + + /// + /// Entity type '{jsonEntity}' is mapped to JSON and has a navigation to a regular entity which is not the owner. + /// + public static string JsonEntityReferencingRegularEntity(object? jsonEntity) + => string.Format( + GetString("JsonEntityReferencingRegularEntity", nameof(jsonEntity)), + jsonEntity); + + /// + /// Setting a default value on properties of an entity mapped to JSON is not supported. Entity: '{jsonEntity}', property: '{property}'. + /// + public static string JsonEntityWithDefaultValueSetOnItsProperty(object? jsonEntity, object? property) + => string.Format( + GetString("JsonEntityWithDefaultValueSetOnItsProperty", nameof(jsonEntity), nameof(property)), + jsonEntity, property); + + /// + /// Key property '{keyProperty}' on JSON-mapped entity '{jsonEntity}' should not have its JSON property name configured explicitly. + /// + public static string JsonEntityWithExplicitlyConfiguredJsonPropertyNameOnKey(object? keyProperty, object? jsonEntity) + => string.Format( + GetString("JsonEntityWithExplicitlyConfiguredJsonPropertyNameOnKey", nameof(keyProperty), nameof(jsonEntity)), + keyProperty, jsonEntity); + + /// + /// Entity type '{jsonEntity}' is part of a collection mapped to JSON and has its ordinal key defined explicitly. Only implicitly defined ordinal keys are supported. + /// + public static string JsonEntityWithExplicitlyConfiguredOrdinalKey(object? jsonEntity) + => string.Format( + GetString("JsonEntityWithExplicitlyConfiguredOrdinalKey", nameof(jsonEntity)), + jsonEntity); + + /// + /// Entity type '{jsonEntity}' has an incorrect number of primary key properties. Expected number is: {expectedCount}, actual number is: {actualCount}. + /// + public static string JsonEntityWithIncorrectNumberOfKeyProperties(object? jsonEntity, object? expectedCount, object? actualCount) + => string.Format( + GetString("JsonEntityWithIncorrectNumberOfKeyProperties", nameof(jsonEntity), nameof(expectedCount), nameof(actualCount)), + jsonEntity, expectedCount, actualCount); + + /// + /// Entity '{jsonEntity}' is mapped to JSON and contains multiple properties or navigations which are mapped to the same JSON property '{property}'. Each property should map to a unique JSON property. + /// + public static string JsonEntityWithMultiplePropertiesMappedToSameJsonProperty(object? jsonEntity, object? property) + => string.Format( + GetString("JsonEntityWithMultiplePropertiesMappedToSameJsonProperty", nameof(jsonEntity), nameof(property)), + jsonEntity, property); + + /// + /// Entity type '{rootType}' references entities mapped to JSON. Only '{tph}' inheritance is supported for those entities. + /// + public static string JsonEntityWithNonTphInheritanceOnOwner(object? rootType, object? tph) + => string.Format( + GetString("JsonEntityWithNonTphInheritanceOnOwner", nameof(rootType), nameof(tph)), + rootType, tph); + + /// + /// Entity type '{entity}' references entities mapped to JSON but is not itself mapped to a table or a view. This is not supported. + /// + public static string JsonEntityWithOwnerNotMappedToTableOrView(object? entity) + => string.Format( + GetString("JsonEntityWithOwnerNotMappedToTableOrView", nameof(entity)), + entity); + + /// + /// Table splitting is not supported for entities containing entities mapped to JSON. + /// + public static string JsonEntityWithTableSplittingIsNotSupported + => GetString("JsonEntityWithTableSplittingIsNotSupported"); + + /// + /// The JSON property name should only be configured on nested owned navigations. + /// + public static string JsonPropertyNameShouldBeConfiguredOnNestedNavigation + => GetString("JsonPropertyNameShouldBeConfiguredOnNestedNavigation"); + /// /// The mapping strategy '{mappingStrategy}' used for '{entityType}' is not supported for keyless entity types. See https://go.microsoft.com/fwlink/?linkid=2130430 for more information. /// @@ -997,6 +1097,12 @@ public static string MappedFunctionNotFound(object? entityType, object? function public static string MappingFragmentMissingName => GetString("MappingFragmentMissingName"); + /// + /// This method needs to be implemented in the provider. + /// + public static string MethodNeedsToBeImplementedInTheProvider + => GetString("MethodNeedsToBeImplementedInTheProvider"); + /// /// Using '{methodName}' on DbSet of '{entityType}' is not supported since '{entityType}' is part of hierarchy and does not contain a discriminator property. /// @@ -1787,112 +1893,6 @@ public static string ViewOverrideMismatch(object? propertySpecification, object? public static string VisitChildrenMustBeOverridden => GetString("VisitChildrenMustBeOverridden"); - /// - /// Owned entity type '{nonJsonType}' is mapped to table '{table}' and contains JSON columns. This is currently not supported. All owned types containing a JSON column must be mapped to a JSON column themselves. - /// - public static string JsonEntityOwnedByNonJsonOwnedType(object? nonJsonType, object? table) - => string.Format( - GetString("JsonEntityOwnedByNonJsonOwnedType", nameof(nonJsonType), nameof(table)), - nonJsonType, table); - - /// - /// Table splitting is not supported for entities containing entities mapped to JSON. - /// - public static string JsonEntityWithTableSplittingIsNotSupported - => GetString("JsonEntityWithTableSplittingIsNotSupported"); - - /// - /// Multiple owned root entities are mapped to the same JSON column '{column}' in table '{table}'. Each owned root entity must map to a different column. - /// - public static string JsonEntityMultipleRootsMappedToTheSameJsonColumn(object? column, object? table) - => string.Format( - GetString("JsonEntityMultipleRootsMappedToTheSameJsonColumn", nameof(column), nameof(table)), - column, table); - - /// - /// Entity type '{entity}' references entities mapped to JSON but is not itself mapped to a table or a view.This is not supported. - /// - public static string JsonEntityWithOwnerNotMappedToTableOrView(object? entity) - => string.Format( - GetString("JsonEntityWithOwnerNotMappedToTableOrView", nameof(entity)), - entity); - - /// - /// Entity '{jsonType}' is mapped to JSON and also mapped to a view '{viewName}', however it's owner '{ownerType}' is mapped to a different view '{ownerViewName}'. Every entity mapped to JSON must also map to the same view as it's owner. - /// - public static string JsonEntityMappedToDifferentViewThanOwner(object? jsonType, object? viewName, object? ownerType, object? ownerViewName) - => string.Format( - GetString("JsonEntityMappedToDifferentViewThanOwner", nameof(jsonType), nameof(viewName), nameof(ownerType), nameof(ownerViewName)), - jsonType, viewName, ownerType, ownerViewName); - - /// - /// Entity type '{rootType}' references entities mapped to JSON. Only '{tph}' inheritance is supported for those entities. - /// - public static string JsonEntityWithNonTphInheritanceOnOwner(object? rootType, object? tph) - => string.Format( - GetString("JsonEntityWithNonTphInheritanceOnOwner", nameof(rootType), nameof(tph)), - rootType, tph); - - /// - /// Entity type '{jsonEntity}' is mapped to JSON and has navigation to a regular entity which is not the owner. - /// - public static string JsonEntityReferencingRegularEntity(object? jsonEntity) - => string.Format( - GetString("JsonEntityReferencingRegularEntity", nameof(jsonEntity)), - jsonEntity); - - /// - /// Key property '{keyProperty}' on JSON-mapped entity '{jsonEntity}' should not have JSON property name configured explicitly. - /// - public static string JsonEntityWithExplicitlyConfiguredJsonPropertyNameOnKey(object? keyProperty, object? jsonEntity) - => string.Format( - GetString("JsonEntityWithExplicitlyConfiguredJsonPropertyNameOnKey", nameof(keyProperty), nameof(jsonEntity)), - keyProperty, jsonEntity); - - /// - /// Entity type '{jsonEntity}' is part of collection mapped to JSON and has it's ordinal key defined explicitly. Only implicitly defined ordinal keys are supported. - /// - public static string JsonEntityWithExplicitlyConfiguredOrdinalKey(object? jsonEntity) - => string.Format( - GetString("JsonEntityWithExplicitlyConfiguredOrdinalKey", nameof(jsonEntity)), - jsonEntity); - - /// - /// Entity type '{jsonEntity}' has incorrect number of primary key properties. Expected number is: {expectedCount}, actual number is: {actualCount}. - /// - public static string JsonEntityWithIncorrectNumberOfKeyProperties(object? jsonEntity, object? expectedCount, object? actualCount) - => string.Format( - GetString("JsonEntityWithIncorrectNumberOfKeyProperties", nameof(jsonEntity), nameof(expectedCount), nameof(actualCount)), - jsonEntity, expectedCount, actualCount); - - /// - /// Setting default value on properties of an entity mapped to JSON is not supported. Entity: '{jsonEntity}', property: '{property}'. - /// - public static string JsonEntityWithDefaultValueSetOnItsProperty(object? jsonEntity, object? property) - => string.Format( - GetString("JsonEntityWithDefaultValueSetOnItsProperty", nameof(jsonEntity), nameof(property)), - jsonEntity, property); - - /// - /// Entity '{jsonEntity}' is mapped to JSON and it contains multiple properties or navigations which are mapped to the same JSON property '{property}'. Each property should map to a unique JSON property. - /// - public static string JsonEntityWithMultiplePropertiesMappedToSameJsonProperty(object? jsonEntity, object? property) - => string.Format( - GetString("JsonEntityWithMultiplePropertiesMappedToSameJsonProperty", nameof(jsonEntity), nameof(property)), - jsonEntity, property); - - /// - /// JSON property name should only be configured on nested owned navigations. - /// - public static string JsonPropertyNameShouldBeConfiguredOnNestedNavigation - => GetString("JsonPropertyNameShouldBeConfiguredOnNestedNavigation"); - - /// - /// This method needs to be implemented in the provider. - /// - public static string MethodNeedsToBeImplementedInTheProvider - => GetString("MethodNeedsToBeImplementedInTheProvider"); - private static string GetString(string name, params string[] formatterNames) { var value = _resourceManager.GetString(name)!; diff --git a/src/EFCore.Relational/Properties/RelationalStrings.resx b/src/EFCore.Relational/Properties/RelationalStrings.resx index aab279ce662..9adb9b32831 100644 --- a/src/EFCore.Relational/Properties/RelationalStrings.resx +++ b/src/EFCore.Relational/Properties/RelationalStrings.resx @@ -478,6 +478,45 @@ The specified 'MinBatchSize' value '{value}' is not valid. It must be a positive number. + + Entity '{jsonType}' is mapped to JSON and also to a view '{viewName}', but its owner '{ownerType}' is mapped to a different view '{ownerViewName}'. Every entity mapped to JSON must also map to the same view as its owner. + + + Multiple owned root entities are mapped to the same JSON column '{column}' in table '{table}'. Each owned root entity must map to a different column. + + + Owned entity type '{nonJsonType}' is mapped to table '{table}' and contains JSON columns. This is currently not supported. All owned types containing a JSON column must be mapped to a JSON column themselves. + + + Entity type '{jsonEntity}' is mapped to JSON and has a navigation to a regular entity which is not the owner. + + + Setting a default value on properties of an entity mapped to JSON is not supported. Entity: '{jsonEntity}', property: '{property}'. + + + Key property '{keyProperty}' on JSON-mapped entity '{jsonEntity}' should not have its JSON property name configured explicitly. + + + Entity type '{jsonEntity}' is part of a collection mapped to JSON and has its ordinal key defined explicitly. Only implicitly defined ordinal keys are supported. + + + Entity type '{jsonEntity}' has an incorrect number of primary key properties. Expected number is: {expectedCount}, actual number is: {actualCount}. + + + Entity '{jsonEntity}' is mapped to JSON and contains multiple properties or navigations which are mapped to the same JSON property '{property}'. Each property should map to a unique JSON property. + + + Entity type '{rootType}' references entities mapped to JSON. Only '{tph}' inheritance is supported for those entities. + + + Entity type '{entity}' references entities mapped to JSON but is not itself mapped to a table or a view. This is not supported. + + + Table splitting is not supported for entities containing entities mapped to JSON. + + + The JSON property name should only be configured on nested owned navigations. + The mapping strategy '{mappingStrategy}' used for '{entityType}' is not supported for keyless entity types. See https://go.microsoft.com/fwlink/?linkid=2130430 for more information. @@ -774,6 +813,9 @@ Table name must be specified to configure a table-specific property mapping. + + This method needs to be implemented in the provider. + Using '{methodName}' on DbSet of '{entityType}' is not supported since '{entityType}' is part of hierarchy and does not contain a discriminator property. @@ -1086,46 +1128,4 @@ 'VisitChildren' must be overridden in the class deriving from 'SqlExpression'. - - Owned entity type '{nonJsonType}' is mapped to table '{table}' and contains JSON columns. This is currently not supported. All owned types containing a JSON column must be mapped to a JSON column themselves. - - - Table splitting is not supported for entities containing entities mapped to JSON. - - - Multiple owned root entities are mapped to the same JSON column '{column}' in table '{table}'. Each owned root entity must map to a different column. - - - Entity type '{entity}' references entities mapped to JSON but is not itself mapped to a table or a view.This is not supported. - - - Entity '{jsonType}' is mapped to JSON and also mapped to a view '{viewName}', however it's owner '{ownerType}' is mapped to a different view '{ownerViewName}'. Every entity mapped to JSON must also map to the same view as it's owner. - - - Entity type '{rootType}' references entities mapped to JSON. Only '{tph}' inheritance is supported for those entities. - - - Entity type '{jsonEntity}' is mapped to JSON and has navigation to a regular entity which is not the owner. - - - Key property '{keyProperty}' on JSON-mapped entity '{jsonEntity}' should not have JSON property name configured explicitly. - - - Entity type '{jsonEntity}' is part of collection mapped to JSON and has it's ordinal key defined explicitly. Only implicitly defined ordinal keys are supported. - - - Entity type '{jsonEntity}' has incorrect number of primary key properties. Expected number is: {expectedCount}, actual number is: {actualCount}. - - - Setting default value on properties of an entity mapped to JSON is not supported. Entity: '{jsonEntity}', property: '{property}'. - - - Entity '{jsonEntity}' is mapped to JSON and it contains multiple properties or navigations which are mapped to the same JSON property '{property}'. Each property should map to a unique JSON property. - - - JSON property name should only be configured on nested owned navigations. - - - This method needs to be implemented in the provider. - \ No newline at end of file