Base solution for your next web application
Open Closed

Help : npm compile errors with PowerTools-generated entities: (navigation properties generating a "Filter" error) #11372


User avatar
0
BarcodesGroup created

I have a fresh new installation of AspNetZero (Angular).

I was able to use Power Tools to generate two basic entities (UOMs and Categories).

I am now trying to generate a new entity (Items) which has a few string properties, and two navigation properties (FK to the UOMs and Categories tables).

npm generates compiler errors as follows:

Here are the json files for all 3 entities:

<< Items.UOM.json >>
{
  "IsRegenerate": true,
  "MenuPosition": "main",
  "RelativeNamespace": "Items",
  "EntityName": "UOM",
  "EntityNamePlural": "UOMs",
  "TableName": "UOMs",
  "PrimaryKeyType": "int",
  "BaseClass": "Entity",
  "EntityHistory": false,
  "AutoMigration": true,
  "UpdateDatabase": true,
  "CreateUserInterface": true,
  "CreateViewOnly": true,
  "CreateExcelExport": true,
  "IsNonModalCRUDPage": true,
  "IsMasterDetailPage": false,
  "PagePermission": {
    "Host": true,
    "Tenant": true
  },
  "Properties": [
    {
      "Name": "Unit",
      "Type": "string",
      "MaxLength": 50,
      "MinLength": 3,
      "Range": {
        "IsRangeSet": false,
        "MinimumValue": 0.0,
        "MaximumValue": 0.0
      },
      "Required": true,
      "Nullable": false,
      "Regex": "",
      "UserInterface": {
        "AdvancedFilter": false,
        "List": true,
        "CreateOrUpdate": true
      },
      "ViewType": null,
      "AdditionalData": {}
    },
    {
      "Name": "Description",
      "Type": "string",
      "MaxLength": 50,
      "MinLength": 3,
      "Range": {
        "IsRangeSet": false,
        "MinimumValue": 0.0,
        "MaximumValue": 0.0
      },
      "Required": true,
      "Nullable": false,
      "Regex": "",
      "UserInterface": {
        "AdvancedFilter": true,
        "List": true,
        "CreateOrUpdate": true
      },
      "ViewType": null,
      "AdditionalData": {}
    },
    {
      "Name": "Abbreviation",
      "Type": "string",
      "MaxLength": 5,
      "MinLength": 2,
      "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": "WMSDemo.Items",
      "ForeignEntityName": "UOMSet",
      "IdType": "int",
      "IsNullable": false,
      "PropertyName": "UOMSetId",
      "DuplicationNumber": 0,
      "RelationType": "single",
      "ViewType": "Dropdown",
      "DisplayPropertyNameInfos": {
        "MergeFormat": null,
        "DisplayPropertyNames": []
      }
    }
  ],
  "NavigationPropertyOneToManyTables": [],
  "EnumDefinitions": [],
  "DbContext": null
}

<< Items.Category.json >>

{
  "IsRegenerate": true,
  "MenuPosition": "main",
  "RelativeNamespace": "Items",
  "EntityName": "ItemCategory",
  "EntityNamePlural": "ItemCategories",
  "TableName": "ItemCategories",
  "PrimaryKeyType": "int",
  "BaseClass": "CreationAuditedEntity",
  "EntityHistory": true,
  "AutoMigration": true,
  "UpdateDatabase": true,
  "CreateUserInterface": true,
  "CreateViewOnly": true,
  "CreateExcelExport": true,
  "IsNonModalCRUDPage": true,
  "IsMasterDetailPage": false,
  "PagePermission": {
    "Host": true,
    "Tenant": true
  },
  "Properties": [
    {
      "Name": "Category",
      "Type": "string",
      "MaxLength": 50,
      "MinLength": 3,
      "Range": {
        "IsRangeSet": false,
        "MinimumValue": 0.0,
        "MaximumValue": 0.0
      },
      "Required": true,
      "Nullable": false,
      "Regex": "",
      "UserInterface": {
        "AdvancedFilter": false,
        "List": true,
        "CreateOrUpdate": true
      },
      "ViewType": null,
      "AdditionalData": {}
    }
  ],
  "NavigationProperties": [],
  "NavigationPropertyOneToManyTables": [],
  "EnumDefinitions": [],
  "DbContext": null
}



<< Items.Item.json >>

{
  "IsRegenerate": false,
  "MenuPosition": "main",
  "RelativeNamespace": "Items",
  "EntityName": "Item",
  "EntityNamePlural": "Items",
  "TableName": "Items",
  "PrimaryKeyType": "int",
  "BaseClass": "FullAuditedEntity",
  "EntityHistory": true,
  "AutoMigration": true,
  "UpdateDatabase": true,
  "CreateUserInterface": true,
  "CreateViewOnly": true,
  "CreateExcelExport": true,
  "IsNonModalCRUDPage": true,
  "IsMasterDetailPage": false,
  "PagePermission": {
    "Host": true,
    "Tenant": true
  },
  "Properties": [
    {
      "Name": "SKU",
      "Type": "string",
      "MaxLength": 50,
      "MinLength": 1,
      "Range": {
        "IsRangeSet": false,
        "MinimumValue": 0.0,
        "MaximumValue": 0.0
      },
      "Required": true,
      "Nullable": false,
      "Regex": "",
      "UserInterface": {
        "AdvancedFilter": true,
        "List": true,
        "CreateOrUpdate": true
      },
      "ViewType": null,
      "AdditionalData": {}
    },
    {
      "Name": "Name",
      "Type": "string",
      "MaxLength": 50,
      "MinLength": 3,
      "Range": {
        "IsRangeSet": false,
        "MinimumValue": 0.0,
        "MaximumValue": 0.0
      },
      "Required": true,
      "Nullable": false,
      "Regex": "",
      "UserInterface": {
        "AdvancedFilter": true,
        "List": true,
        "CreateOrUpdate": true
      },
      "ViewType": null,
      "AdditionalData": {}
    },
    {
      "Name": "Description",
      "Type": "string",
      "MaxLength": 500,
      "MinLength": 0,
      "Range": {
        "IsRangeSet": false,
        "MinimumValue": 0.0,
        "MaximumValue": 0.0
      },
      "Required": false,
      "Nullable": false,
      "Regex": "",
      "UserInterface": {
        "AdvancedFilter": true,
        "List": false,
        "CreateOrUpdate": true
      },
      "ViewType": null,
      "AdditionalData": {}
    },
    {
      "Name": "BasePrice",
      "Type": "decimal",
      "MaxLength": 0,
      "MinLength": 0,
      "Range": {
        "IsRangeSet": true,
        "MinimumValue": 0.0,
        "MaximumValue": 999999.0
      },
      "Required": false,
      "Nullable": false,
      "Regex": "",
      "UserInterface": {
        "AdvancedFilter": false,
        "List": true,
        "CreateOrUpdate": true
      },
      "ViewType": null,
      "AdditionalData": {}
    }
  ],
  "NavigationProperties": [
    {
      "Namespace": "WMSDemo.Items",
      "ForeignEntityName": "ItemCategory",
      "IdType": "int",
      "IsNullable": false,
      "PropertyName": "ItemCategoryId",
      "DuplicationNumber": 0,
      "RelationType": "single",
      "ViewType": "LookupTable",
      "DisplayPropertyNameInfos": {
        "MergeFormat": "{0}",
        "DisplayPropertyNames": [
          "Category"
        ]
      }
    },
    {
      "Namespace": "WMSDemo.Items",
      "ForeignEntityName": "UOM",
      "IdType": "int",
      "IsNullable": false,
      "PropertyName": "UOMId",
      "DuplicationNumber": 0,
      "RelationType": "single",
      "ViewType": "Dropdown",
      "DisplayPropertyNameInfos": {
        "MergeFormat": "{0}",
        "DisplayPropertyNames": [
          "Unit"
        ]
      }
    }
  ],
  "NavigationPropertyOneToManyTables": [],
  "EnumDefinitions": [],
  "DbContext": null
}


2 Answer(s)
  • User Avatar
    0
    BarcodesGroup created

    I manually edited the .components.ts file and added the "this."

    The project builds and runs.

    Can I make this fix in a Power Tools template file, so the problem doesn't happen again?

  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @BarcodesGroup,

    It's reported at https://github.com/aspnetzero/aspnet-zero-core/issues/4654

    The temporary solution is here https://github.com/aspnetzero/aspnet-zero-core/issues/4654#issuecomment-1333954318