Base solution for your next web application
Open Closed

Power tools 4.10.0 some bugs in version 15.2.0 Core MVC project #12641


User avatar
0
tdv.yazilim created

Hello,

While developing with ASP.NET Zero Core MVC 15.2.0 and Power Tools 4.10.0, I encountered several issues related to entity generation and multilingual functionality. I’ve outlined them step by step below:


🔹 1. Repository Definition (Guid Primary Key)

After creating the City entity, the repository was generated as:

IRepository<City> _cityRepository;

However, since the entity uses a Guid as the primary key, this caused issues. I had to manually update it to:

IRepository<City, Guid> _cityRepository;

🔹 2. Controller Parameter Binding Issue

In the following action method:

public async Task<ActionResult> ViewCity(Guid id)
{
    var input = new EntityDto<Guid> { Id = id };
    var result = await _citiesAppService.GetCityForView(input);

    var model = new CityViewModel
    {
        City = result.City,
        OrganizationUnitDisplayName = result.OrganizationUnitDisplayName
    };

    return View(model);
}

I encountered a parsing/binding error when using Guid directly as a parameter. As a workaround, I had to manually create an EntityDto<Guid> object.


🔹 3. CreateOrEdit.cshtml Issues

In the generated view file, the following localization keys had formatting issues:

  • Non_Multi_Lingual_Property_Desc
  • Multi_Lingual_Property_Desc

There were leading whitespaces, and I had to fix them manually.


🔹 4. Menu Definition Issue

The generated menu code used:

AppPagesName.Common.Cities

However, the correct usage in the project is:

PortalPageNames.Common.Cities

This also required manual correction.


🔹 5. Multilingual Data Issue

There is an unexpected behavior in the multilingual structure:

  • When adding a new language record, the previous record is soft-deleted
  • Multiple translations for the same entity cannot be maintained properly
  • A new record must be created for each language

Expected behavior: ➡️ Multiple translations should coexist under the same entity without affecting each other


🔹 6. Translation Field is Null in Grid

In the listing (grid), the Name field is returned as null.

Current situation:

  • Translations are included in the query
  • Custom mapping is applied
public override void Map(City source, CityDto destination)
{
    var translation = source.GetTranslation(CultureInfo.CurrentUICulture.Name);
    destination.Name = translation?.Name;
}

Despite this, the Name field remains empty.


🔹 7. General Observations

Issues observed in the Power Tools generated code:

  • Repository generic type is incorrectly generated (missing Guid)
  • Controller parameter binding problems
  • Localization key formatting issues in views
  • Incorrect menu reference (PortalPageNames instead of AppPageNames)
  • Multilingual structure not functioning as expected (soft delete issue)
  • Translation fields are not mapped correctly

🔹 Expectation

  • Verification of these issues in the specified versions
  • Guidance on the correct approach for multilingual data handling and mapping
  • Review and fixes for the Power Tools code generation process

I can also provide the sample JSON model if needed for testing.

{
  "IsRegenerate": false,
  "MenuPosition": "main",
  "RelativeNamespace": "Cities",
  "EntityName": "City",
  "EntityNamePlural": "Cities",
  "TableName": "Cities",
  "PrimaryKeyType": "Guid",
  "BaseClass": "FullAuditedEntity",
  "EntityHistory": false,
  "AutoMigration": true,
  "UpdateDatabase": true,
  "CreateUserInterface": true,
  "CreateViewOnly": true,
  "CreateExcelExport": true,
  "CreateExcelImport": true,
  "IsNonModalCRUDPage": true,
  "IsMasterDetailPage": false,
  "GenerateOverridableEntity": false,
  "GenerateUnitTest": false,
  "GenerateUiTest": false,
  "GenerateMobile": true,
  "CreateMauiView": true,
  "PagePermission": {
    "Host": true,
    "Tenant": true
  },
  "Properties": [
    {
      "Name": "Name",
      "Type": "string",
      "MaxLength": 128,
      "MinLength": 2,
      "Range": {
        "IsRangeSet": false,
        "MinimumValue": 0.0,
        "MaximumValue": 0.0
      },
      "Required": false,
      "Nullable": false,
      "Regex": "",
      "IsMultiLingual": true,
      "UserInterface": {
        "AdvancedFilter": true,
        "List": true,
        "ListMaui": true,
        "CreateOrUpdate": true
      },
      "ViewType": null,
      "AdditionalData": {}
    },
    {
      "Name": "Plate",
      "Type": "string",
      "MaxLength": 2,
      "MinLength": 0,
      "Range": {
        "IsRangeSet": false,
        "MinimumValue": 0.0,
        "MaximumValue": 0.0
      },
      "Required": false,
      "Nullable": false,
      "Regex": "",
      "IsMultiLingual": false,
      "UserInterface": {
        "AdvancedFilter": true,
        "List": true,
        "ListMaui": true,
        "CreateOrUpdate": true
      },
      "ViewType": null,
      "AdditionalData": {}
    },
    {
      "Name": "IsActive",
      "Type": "bool",
      "MaxLength": 0,
      "MinLength": 0,
      "Range": {
        "IsRangeSet": false,
        "MinimumValue": 0.0,
        "MaximumValue": 0.0
      },
      "Required": false,
      "Nullable": false,
      "Regex": "",
      "IsMultiLingual": false,
      "UserInterface": {
        "AdvancedFilter": true,
        "List": true,
        "ListMaui": true,
        "CreateOrUpdate": true
      },
      "ViewType": null,
      "AdditionalData": {}
    }
  ],
  "NavigationProperties": [
    {
      "Namespace": "Abp.Organizations",
      "ForeignEntityName": "OrganizationUnit",
      "ForeignEntityNamePlural": "OrganizationUnits",
      "IdType": "long",
      "IsNullable": true,
      "PropertyName": "OrganizationUnitId",
      "DuplicationNumber": 0,
      "RelationType": "single",
      "ViewType": "LookupTable",
      "DisplayPropertyNameInfos": {
        "MergeFormat": "{0}",
        "DisplayProperties": {
          "DisplayName": "string"
        }
      },
      "IsMultiLingual": false
    }
  ],
  "NavigationPropertyOneToManyTables": [],
  "EnumDefinitions": [],
  "DbContext": null
}

Thank you in advance.

Best regards.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

3 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @tdv.yazilim

    Thank you so much for your detailed feedback. We have created an issue addressing the problems you mentioned. We will fix them quickly and let you know when it's complete.

    Thank you.

    Best Regards.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @tdv.yazilim

    We've completed this issue and fixed the problems you pointed out thanks to you. These issues will also be fixed on your end when we create a new version of Power Tools.

    Thank you.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    tdv.yazilim created

    Hi @oguzhanagir

    Thank you for feedback. We will be wait new version.

    Best regards.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)