Skip to content

Commit

Permalink
Exception message review by Shay
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Aug 11, 2022
1 parent 41a82fa commit 9eab360
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2452,8 +2452,7 @@ protected virtual void ValidateJsonEntityRoot(
{
// issue #28443
throw new InvalidOperationException(
RelationalStrings.JsonEntityWithNonTphInheritanceOnOwner(
rootType.DisplayName(), RelationalAnnotationNames.TphMappingStrategy));
RelationalStrings.JsonEntityWithNonTphInheritanceOnOwner(rootType.DisplayName()));
}
}

Expand Down
26 changes: 13 additions & 13 deletions src/EFCore.Relational/Properties/RelationalStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions src/EFCore.Relational/Properties/RelationalStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@
<value>The following lambda argument to 'SetProperty' does not represent a valid property to be set: '{propertyExpression}'.</value>
</data>
<data name="JsonEntityMappedToDifferentViewThanOwner" xml:space="preserve">
<value>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.</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.</value>
</data>
<data name="JsonEntityMultipleRootsMappedToTheSameJsonColumn" xml:space="preserve">
<value>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.</value>
Expand All @@ -494,34 +494,34 @@
<value>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.</value>
</data>
<data name="JsonEntityReferencingRegularEntity" xml:space="preserve">
<value>Entity type '{jsonEntity}' is mapped to JSON and has navigation to a regular entity which is not the owner.</value>
<value>Entity type '{jsonEntity}' is mapped to JSON and has a navigation to a regular entity which is not the owner.</value>
</data>
<data name="JsonEntityWithDefaultValueSetOnItsProperty" xml:space="preserve">
<value>Setting default value on properties of an entity mapped to JSON is not supported. Entity: '{jsonEntity}', property: '{property}'.</value>
<value>Setting a default value on properties of an entity mapped to JSON is not supported. Entity: '{jsonEntity}', property: '{property}'.</value>
</data>
<data name="JsonEntityWithExplicitlyConfiguredJsonPropertyNameOnKey" xml:space="preserve">
<value>Key property '{keyProperty}' on JSON-mapped entity '{jsonEntity}' should not have JSON property name configured explicitly.</value>
<value>Key property '{keyProperty}' on JSON-mapped entity '{jsonEntity}' should not have its JSON property name configured explicitly.</value>
</data>
<data name="JsonEntityWithExplicitlyConfiguredOrdinalKey" xml:space="preserve">
<value>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.</value>
<value>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.</value>
</data>
<data name="JsonEntityWithIncorrectNumberOfKeyProperties" xml:space="preserve">
<value>Entity type '{jsonEntity}' has incorrect number of primary key properties. Expected number is: {expectedCount}, actual number is: {actualCount}.</value>
<value>Entity type '{jsonEntity}' has an incorrect number of primary key properties. Expected number is: {expectedCount}, actual number is: {actualCount}.</value>
</data>
<data name="JsonEntityWithMultiplePropertiesMappedToSameJsonProperty" xml:space="preserve">
<value>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.</value>
<value>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.</value>
</data>
<data name="JsonEntityWithNonTphInheritanceOnOwner" xml:space="preserve">
<value>Entity type '{rootType}' references entities mapped to JSON. Only '{tph}' inheritance is supported for those entities.</value>
<value>Entity type '{rootType}' references entities mapped to JSON. Only TPH inheritance is supported for those entities.</value>
</data>
<data name="JsonEntityWithOwnerNotMappedToTableOrView" xml:space="preserve">
<value>Entity type '{entity}' references entities mapped to JSON but is not itself mapped to a table or a view.This is not supported.</value>
<value>Entity type '{entity}' references entities mapped to JSON but is not itself mapped to a table or a view. This is not supported.</value>
</data>
<data name="JsonEntityWithTableSplittingIsNotSupported" xml:space="preserve">
<value>Table splitting is not supported for entities containing entities mapped to JSON.</value>
</data>
<data name="JsonPropertyNameShouldBeConfiguredOnNestedNavigation" xml:space="preserve">
<value>JSON property name should only be configured on nested owned navigations.</value>
<value>The JSON property name should only be configured on nested owned navigations.</value>
</data>
<data name="KeylessMappingStrategy" xml:space="preserve">
<value>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.</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ public void Tpt_not_supported_for_owner_of_json_entity_on_base()
});

VerifyError(
RelationalStrings.JsonEntityWithNonTphInheritanceOnOwner(
nameof(ValidatorJsonEntityInheritanceBase), "TPH"),
RelationalStrings.JsonEntityWithNonTphInheritanceOnOwner(nameof(ValidatorJsonEntityInheritanceBase)),
modelBuilder);
}

Expand All @@ -149,8 +148,7 @@ public void Tpt_not_supported_for_owner_of_json_entity_on_derived()
});

VerifyError(
RelationalStrings.JsonEntityWithNonTphInheritanceOnOwner(
nameof(ValidatorJsonEntityInheritanceBase), "TPH"),
RelationalStrings.JsonEntityWithNonTphInheritanceOnOwner(nameof(ValidatorJsonEntityInheritanceBase)),
modelBuilder);
}

Expand All @@ -175,8 +173,7 @@ public void Tpt_not_supported_for_owner_of_json_entity_mapping_strategy_explicit
});

VerifyError(
RelationalStrings.JsonEntityWithNonTphInheritanceOnOwner(
nameof(ValidatorJsonEntityInheritanceBase), "TPH"),
RelationalStrings.JsonEntityWithNonTphInheritanceOnOwner(nameof(ValidatorJsonEntityInheritanceBase)),
modelBuilder);
}

Expand All @@ -198,8 +195,7 @@ public void Tpt_not_supported_for_owner_of_json_entity_same_table_names_differen
});

VerifyError(
RelationalStrings.JsonEntityWithNonTphInheritanceOnOwner(
nameof(ValidatorJsonEntityInheritanceBase), "TPH"),
RelationalStrings.JsonEntityWithNonTphInheritanceOnOwner(nameof(ValidatorJsonEntityInheritanceBase)),
modelBuilder);
}

Expand All @@ -218,8 +214,7 @@ public void Tpc_not_supported_for_owner_of_json_entity()
});

VerifyError(
RelationalStrings.JsonEntityWithNonTphInheritanceOnOwner(
nameof(ValidatorJsonEntityInheritanceBase), "TPH"),
RelationalStrings.JsonEntityWithNonTphInheritanceOnOwner(nameof(ValidatorJsonEntityInheritanceBase)),
modelBuilder);
}

Expand Down Expand Up @@ -278,9 +273,7 @@ public void Json_entity_with_defalt_value_on_a_property()
});
});

VerifyError(
"Setting default value on properties of an entity mapped to JSON is not supported. Entity: 'ValidatorJsonOwnedRoot', property: 'Name'.",
modelBuilder);
VerifyError(RelationalStrings.JsonEntityWithDefaultValueSetOnItsProperty("ValidatorJsonOwnedRoot", "Name"), modelBuilder);
}

[ConditionalFact]
Expand Down Expand Up @@ -323,9 +316,7 @@ public void Json_entity_with_explicit_ordinal_key_on_collection_throws()
});
});

VerifyError(
"Entity type 'ValidatorJsonOwnedExplicitOrdinal' is part of collection mapped to JSON and has it's ordinal key defined explicitly. Only implicitly defined ordinal keys are supported.",
modelBuilder);
VerifyError(RelationalStrings.JsonEntityWithExplicitlyConfiguredOrdinalKey("ValidatorJsonOwnedExplicitOrdinal"), modelBuilder);
}

[ConditionalFact]
Expand Down Expand Up @@ -365,8 +356,7 @@ public void Json_entity_with_multiple_properties_mapped_to_same_json_name()
b.Ignore(x => x.OwnedCollection);
});

VerifyError(
"Entity 'ValidatorJsonOwnedRoot' is mapped to JSON and it contains multiple properties or navigations which are mapped to the same JSON property 'Foo'. Each property should map to a unique JSON property.",
VerifyError(RelationalStrings.JsonEntityWithMultiplePropertiesMappedToSameJsonProperty("ValidatorJsonOwnedRoot", "Foo"),
modelBuilder);
}

Expand All @@ -384,8 +374,8 @@ public void Json_entity_with_property_and_navigation_mapped_to_same_json_name()
bb.OwnsOne(x => x.NestedReference, bbb => bbb.HasJsonPropertyName("Name"));
bb.Ignore(x => x.NestedCollection);
});
b.Ignore(x => x.OwnedCollection);
});
b.Ignore(x => x.OwnedCollection);
});

VerifyError(
RelationalStrings.JsonEntityWithMultiplePropertiesMappedToSameJsonProperty(
Expand Down

0 comments on commit 9eab360

Please sign in to comment.