We are trying to add a new table, and it will have a navigation property from the table below in point 2 When selecting a navigation property, Power tools throws errors as shared in point 1. Power tools are throwing an error when creating navigation properties
we are trying to use Id of this table as FK in another table "TableX"
6 Answer(s)
-
0
Hi @InteractivePartners
Thank you for reaching out.
From your description, it seems you're encountering an error when trying to add a new table (TableX) with a navigation property referencing an existing table (TableY) using ASP.NET Zero Power Tools.
In order to assist you more effectively, could you please provide the following details:
- The full schema of the new table (TableX), especially the foreign key definition referencing TableY.
- The versions of ASP.NET Zero and Power Tools you are currently using.
- The EF entity class definition for TableY, including the Id property and any related navigation properties, if already defined.
You may also share the .json entity definition file you created for Power Tools (after removing any sensitive information), as it will help us understand the configuration more clearly.
Once we have this information, we’ll be better positioned to identify the root cause and guide you accordingly.
Thank you
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @InteractivePartners
Thank you for reaching out.
From your description, it seems you're encountering an error when trying to add a new table (TableX) with a navigation property referencing an existing table (TableY) using ASP.NET Zero Power Tools.
In order to assist you more effectively, could you please provide the following details:
- The full schema of the new table (TableX), especially the foreign key definition referencing TableY.
- The versions of ASP.NET Zero and Power Tools you are currently using.
- The EF entity class definition for TableY, including the Id property and any related navigation properties, if already defined.
You may also share the .json entity definition file you created for Power Tools (after removing any sensitive information), as it will help us understand the configuration more clearly.
Once we have this information, we’ll be better positioned to identify the root cause and guide you accordingly.
Thank you
Hi @oguzhanagir
Yes, I am trying to add a new table (TableX) with a navigation property referencing an existing table (TableY) Here is the more details as you require
The full schema of the new table (TableX), especially the foreign key definition referencing TableY. Here is an example schema for my tables

The versions of ASP.NET Zero and Power Tools you are currently using. I am using ASP.NET Core & Angular V 14.0.0 and Power Tools V4.6.3
The EF entity class definition for TableY, including the Id property and any related navigation properties, if already defined.

I am trying to create a Tablex EF entity Class below

Thanks
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @InteractivePartners
Thank you for your feedback. The issue you encountered is occurring because a Display Property was not selected. When creating the
TableXentity, you selectedTableYas a Navigation Property. Upon inspection, we noticed that theTableYentity does not contain any properties of type "string".During the Navigation Property association, the UI requires a string-typed property to be used as the display value. Once a string-type property is added to the
TableYentity, the issue should be resolved.We have created an issue to add a warning in the ui indicating that a string-type property is required when adding a navigation property.
We will also edit it so that it will not only be a string type but also types that will be suitable for display properties in UI. We have created a separate issue for this. You can follow the developments here.
A Temporary Solution If You Don't Want a String Value in the TableY Table
First, in the
TableYtable, we regenerate a property that has an integer value as a string type. After regenerating, when creating theTableXtable, while adding the navigation property forTableY, we select the property (which we temporarily converted from int to string) as the Display Property.After selecting it, we generate the
TableXentity. Then, we go back to the Regenerate Entity process and revert the previously converted property in theTableYentity from string back to its original int type, and regenerate it again.At this point, some issues will occur in the
TableXAppServiceclass. These are type mismatch issues, usually due to comparison mismatches. You can resolve these issues with changes like the one below:Example
e.TableYFk.Description.ToString() == input.TableYDescriptionFilterMarkdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @oguzhanagir
A Temporary Solution If You Don't Want a String Value in the TableY Table
First, in the TableY table, we regenerate a property that has an integer value as a string type. After regenerating, when creating the TableX table, while adding the navigation property for TableY, we select the property (which we temporarily converted from int to string) as the Display Property.
We have tried using the suggested approach, but it is not working as well. Table now has a temporary string column but navigation properties are still throwing an error. Attaching here error message

json template: {"IsRegenerate":true,"MenuPosition":"Collections","RelativeNamespace":"CollectionImportsModule","EntityName":"CollectionImport","EntityNamePlural":"CollectionImports","TableName":"CollectionImports","PrimaryKeyType":"int","BaseClass":"FullAuditedEntity","EntityHistory":false,"AutoMigration":true,"UpdateDatabase":true,"CreateUserInterface":true,"CreateViewOnly":true,"CreateExcelExport":true,"CreateExcelImport":true,"IsNonModalCRUDPage":false,"IsMasterDetailPage":false,"GenerateOverridableEntity":true,"GenerateUnitTest":false,"GenerateUiTest":false,"GenerateMobile":false,"PagePermission":{"Host":true,"Tenant":true},"Properties":[{"Name":"ImportFile","Type":"file","MaxLength":-1,"MinLength":-1,"Range":{"IsRangeSet":false,"MinimumValue":0.0,"MaximumValue":0.0},"Required":false,"Nullable":false,"Regex":"","IsMultiLingual":false,"UserInterface":{"AdvancedFilter":false,"List":false,"ListMaui":false,"CreateOrUpdate":true},"ViewType":null,"AdditionalData":{}},{"Name":"IsFileImported","Type":"bool","MaxLength":-1,"MinLength":-1,"Range":{"IsRangeSet":false,"MinimumValue":0.0,"MaximumValue":0.0},"Required":false,"Nullable":false,"Regex":"","IsMultiLingual":false,"UserInterface":{"AdvancedFilter":false,"List":false,"ListMaui":false,"CreateOrUpdate":true},"ViewType":null,"AdditionalData":{}},{"Name":"ZeroBugTempFix","Type":"string","MaxLength":-1,"MinLength":-1,"Range":{"IsRangeSet":false,"MinimumValue":0.0,"MaximumValue":0.0},"Required":false,"Nullable":true,"Regex":"","IsMultiLingual":false,"UserInterface":{"AdvancedFilter":false,"List":true,"ListMaui":false,"CreateOrUpdate":true},"ViewType":null,"AdditionalData":{}}],"NavigationProperties":[{"Namespace":"WebEdCloud.CollectionDistributionsModule","ForeignEntityName":"CollectionDistribution","ForeignEntityNamePlural":"CollectionDistributions","IdType":"int","IsNullable":false,"PropertyName":"CollectionDistributionId","DuplicationNumber":0,"RelationType":"single","ViewType":"Dropdown","DisplayPropertyNameInfos":{"MergeFormat":"{0}","DisplayPropertyNames":["CollectionDistributionName"]},"IsMultiLingual":false},{"Namespace":"WebEdCloud.CollectionSocietiesModule","ForeignEntityName":"CollectionSociety","ForeignEntityNamePlural":"CollectionSocieties","IdType":"int","IsNullable":false,"PropertyName":"CollectionSocietyId","DuplicationNumber":0,"RelationType":"single","ViewType":"Dropdown","DisplayPropertyNameInfos":{"MergeFormat":"{0}","DisplayPropertyNames":["SocietyName"]},"IsMultiLingual":false},{"Namespace":"WebEdCloud.CollectionFinanceLedgersModule","ForeignEntityName":"CollectionFinanceLedger","ForeignEntityNamePlural":"CollectionFinanceLedgers","IdType":"int","IsNullable":true,"PropertyName":"CollectionFinanceLedgerId","DuplicationNumber":0,"RelationType":"single","ViewType":"Dropdown","DisplayPropertyNameInfos":{"MergeFormat":"{0}","DisplayPropertyNames":["CurrencyCode"]},"IsMultiLingual":false}],"NavigationPropertyOneToManyTables":[],"EnumDefinitions":[],"DbContext":null}
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @InteractivePartners
Thank you for your feedback. This is an incorrect error message and we have created an issue to address it. Once the issue is merged, we will release a new version of Power Tools as soon as possible. We appreciate your understanding.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @InteractivePartners
Power Tools v4.8.0 has been released. You can resolve the issue you were experiencing by updating your Power Tools to the latest version. Thank you.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)



