I'm getting many Angular compilation errors after creating a Master-Details entity.
I first created a simple CRUD entity named Customer, migrated the database, rebuilt Angular UI, etc.... This entity is working fine (it just has a few String properties).
Next, I created a Master/Details entity named "SalesRegion". The intention is that each SalesRegion will have multiple customers assigned to it (1-Many).
Here's how I configured SalesRegion:
After performing the migration, nswag/refresh, etc... I now get many npm errors. The first critical errors:
Looking at the console log from Power Tools, I don't see any references to those components listed in the first 2 errors. So that's the first problem I need to solve.
I am wondering if I'm doing something wrong in the Power Tools setup for this type of entity, or if there are some other issues with Master-Details?
12 Answer(s)
-
0
though I am not aspnetzero support, your problem looks like mine in 'possible power tools problem #11351'. I have no idea when it will really be fixed. I suggest looking for the next version of Power tools > 3.2.2 to get a possible fix. The aspnetzero person tried to fix the issue with a custom template, but that did not work.
-
0
I am still unable to create any Master-Detail entities, no matter how I configure it. PowerTools works fine, but the angular compilation fails due to missing components and many other errors.
If I change it to a 'standard' entity type and regenerate, then it works fine.
Is there any way to make Master-Detail (1:many) work?
-
0
Hi,
@m.aliozkaya will take a look at this problem. @BarcodesGroup is it possible to share generated JSON files with us as well ?
-
0
FYI, the latest power tools 3.2.3 does not fix my problem and I am sure it is related to this problem. I have shared my github solution with aspnetzero people.
-
0
Hi @BarcodesGroup
I created an issue about your problem https://github.com/aspnetzero/aspnet-zero-core/issues/4660 We will fix the problem as soon as possible.
-
0
I just downloaded a new ASPNetZero solution (core+Angular).. I tried to use the newest Power Tools (in VS2022) to generate a Master-Detail relationship with 2 very simple entities:
I would like to be able to create a view for each Category, where the Subcategories for that Category are listed (and there is also a link to create a new Subcategory for the currently selected Category).
I can't compile the Angular project (I get the same errors about missing 'view' and 'create or edit' components).
Will there be a new version of Power Tools soon (with Master-Detail working for Angular)?
-
0
Any update on this?
-
0
Hi @lschelvan
Could you share your generated json files
-
0
**Here is the console output from Power Tools ** (generated ItemCategories as Master-Detail)....(I've redacted the calls to prettier, etc.)
Starting to create child table items for Items.ItemSubcategory.json -> ItemSubcategoriesAppService.cs is being generated. -> IItemSubcategoriesAppService.cs is being generated. -> ItemSubcategoryConsts.cs is being generated. -> CreateOrEditItemSubcategoryDto.cs is being generated. -> ItemSubcategoryDto.cs is being generated. -> GetAllItemSubcategoriesForExcelInput.cs is being generated. -> GetAllForLookupTableInput.cs is being generated. -> GetAllItemSubcategoriesInput.cs is being generated. -> GetItemSubcategoryForViewDto.cs is being generated. -> GetItemSubcategoryForEditOutput.cs is being generated. -> ItemSubcategoryItemCategoryLookupTableDto.cs is being generated. -> ItemSubcategory.cs is being generated. -> ItemSubcategoriesExcelExporter.cs is being generated. -> IItemSubcategoriesExcelExporter.cs is being generated. -> AppPermissions.cs is being modified. -> AppAuthorizationProvider.cs is being modified. -> WMSPlatformDbContext.cs is being modified. -> CustomDtoMapper.cs is being modified. -> itemSubcategories.component.ts is being generated. -> itemSubcategories.component.html is being generated. -> create-or-edit-itemSubcategory.component.html is being generated. -> create-or-edit-itemSubcategory.component.ts is being generated. -> itemSubcategory-itemCategory-lookup-table-modal.component.ts is being generated. -> itemSubcategory-itemCategory-lookup-table-modal.component.html is being generated. -> itemSubcategory-itemCategory-lookup-table-modal.component.less is being generated. -> itemSubcategory.module.ts is being generated. -> itemSubcategory-routing.module.ts is being generated. -> view-itemSubcategory.component.html is being generated. -> view-itemSubcategory.component.ts is being generated. -> main-routing.module.ts is being modified. -> app-navigation.service.ts is being modified. -> service-proxy.module.ts is being modified. -> WMSPlatform.xml is being modified. -> Formatting generated client side files. yarn run v1.22.19 XXX Done in 2.43s. -> AppPermissions.cs is being modified. -> AppAuthorizationProvider.cs is being modified. -> WMSPlatformDbContext.cs is being modified. -> CustomDtoMapper.cs is being modified. -> masterDetailChild_ItemCategory_itemSubcategories.component.ts is being generated. -> masterDetailChild_ItemCategory_itemSubcategories.component.html is being generated. -> masterDetailChild_ItemCategory_itemSubcategory.module.ts is being generated. -> service-proxy.module.ts is being modified. -> masterDetailChild_ItemCategory_itemSubcategories.component.ts is being modified. -> WMSPlatform.xml is being modified. -> Formatting generated client side files. yarn run v1.22.19 XXX Done in 2.73s.
Child table items for Items.ItemSubcategory.json were created!
-> itemCategories.component.ts is being generated. -> itemCategories.component.html is being generated. -> create-or-edit-itemCategory-modal.component.html is being generated. -> create-or-edit-itemCategory-modal.component.ts is being generated. -> itemCategory.module.ts is being generated. -> itemCategory-routing.module.ts is being generated. -> view-itemCategory-modal.component.html is being generated. -> view-itemCategory-modal.component.ts is being generated. -> main-routing.module.ts is being modified. -> app-navigation.service.ts is being modified. -> service-proxy.module.ts is being modified. -> WMSPlatform.xml is being modified. -> ItemSubcategoriesAppService.cs is being modified. -> GetAllItemSubcategoriesInput.cs is being modified. -> GetAllItemSubcategoriesForExcelInput.cs is being modified. -> Formatting generated client side files. yarn run v1.22.19 XXX Done in 3.08s.
Code generation is complete. Press ENTER to exit..
.
Angular compilation generates these errors: (There are many more errors that follow)
` ./src/app/main/items/itemSubcategories/masterDetailChild_ItemCategory_itemSubcategory.module.ts:11:0-160 - Error: Module not found: Error: Can't resolve './masterDetailChild_ItemCategory_create-or-edit-itemSubcategory.component' in 'D:\XXX\angular\src\app\main\items\itemSubcategories'
./src/app/main/items/itemSubcategories/masterDetailChild_ItemCategory_itemSubcategory.module.ts:12:0-142 - Error: Module not found: Error: Can't resolve './masterDetailChild_ItemCategory_view-itemSubcategory.component' in 'D:\XXX\angular\src\app\main\items\itemSubcategories'
Error: src/app/main/items/itemCategories/itemCategory.module.ts:17:9 - error NG6002: 'MasterDetailChild_ItemCategory_ItemSubcategoryModule' does not appear to be an NgModule class.
17 MasterDetailChild_ItemCategory_ItemSubcategoryModule, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `
Power Tools did not generate the files indicated (masterDetailChild_ItemCategory_create-or-edit-itemSubcategory.component and masterDetailChild_ItemCategory_view-itemSubcategory.component).
**Items.ItemCategory.json: **
{ "IsRegenerate": false, "MenuPosition": "main", "RelativeNamespace": "Items", "EntityName": "ItemCategory", "EntityNamePlural": "ItemCategories", "TableName": "ItemCategories", "PrimaryKeyType": "long", "BaseClass": "Entity", "EntityHistory": false, "AutoMigration": false, "UpdateDatabase": false, "CreateUserInterface": true, "CreateViewOnly": true, "CreateExcelExport": true, "IsNonModalCRUDPage": false, "IsMasterDetailPage": true, "PagePermission": { "Host": true, "Tenant": true }, "Properties": [ { "Name": "Category", "Type": "string", "MaxLength": 50, "MinLength": 0, "Range": { "IsRangeSet": false, "MinimumValue": 0.0, "MaximumValue": 0.0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true }, "ViewType": null, "AdditionalData": {} } ], "NavigationProperties": [], "NavigationPropertyOneToManyTables": [ { "EntityJson": "Items.ItemSubcategory.json", "ForeignPropertyName": "ItemCategoryId", "IsNullable": "False", "DisplayPropertyName": "Category", "ViewType": "LookupTable" }, ], "EnumDefinitions": [], "DbContext": null }
Items.ItemSubcategory.json
{ "IsRegenerate": false, "MenuPosition": "main", "RelativeNamespace": "Items", "EntityName": "ItemSubcategory", "EntityNamePlural": "ItemSubcategories", "TableName": "ItemSubcategories", "PrimaryKeyType": "long", "BaseClass": "Entity", "EntityHistory": false, "AutoMigration": false, "UpdateDatabase": false, "CreateUserInterface": true, "CreateViewOnly": true, "CreateExcelExport": true, "IsNonModalCRUDPage": true, "IsMasterDetailPage": false, "PagePermission": { "Host": true, "Tenant": true }, "Properties": [ { "Name": "Subcategory", "Type": "string", "MaxLength": 50, "MinLength": 0, "Range": { "IsRangeSet": false, "MinimumValue": 0.0, "MaximumValue": 0.0 }, "Required": true, "Nullable": false, "Regex": "", "UserInterface": { "AdvancedFilter": true, "List": true, "CreateOrUpdate": true }, "ViewType": null, "AdditionalData": {} } ], "NavigationProperties": [{ "Namespace": "WMSPlatform.Items", "ForeignEntityName": "ItemCategory", "IdType": "long", "IsNullable": false, "PropertyName": "ItemCategoryId", "DisplayPropertyName": "Category", "DuplicationNumber": 0, "RelationType": "single", "ViewType": "LookupTable", "IsGeneratedByMasterPage": true },], "NavigationPropertyOneToManyTables": [], "EnumDefinitions": [], "DbContext": null }
Also, I cannot use the Power Tools "Regenerate Entity" function with any entity that has navigation properties, because of runtime errors during generation, but that's a separate issue.
I generated the entity again as a normal CRUD (not Master-Detail) so that I can continue to work on this project, but I really need to set these entities up as Master-Detail (and I have quite a few other entities that are master-detail or 1:many).
-
0
I am wondering if anybody out there is able to generate Master-Detail entities. If you can, could you zip up your AspNetZeroRadTool/FileTemplates folder and share it?
I started a project 2 weeks ago and have been unable to proceed due to this issue.
-
0
Is there any update on this?
I am wondering if anybody out there is able to generate Master-Detail entities. If you can, could you zip up your AspNetZeroRadTool/FileTemplates folder and share it?
I started a project more than 2 weeks ago and have been unable to proceed due to this issue. (I want to be able to use Power Tools to scaffold all my master-detail views, so that I don't have to write that code from scratch).
-
0
Any update?