Open Closed

abp suite Generate parent-child relationship, child entity, missing save function #6485


User avatar
0
829098@qq.com created

ABP Framework version: v8.0.1

UI Type: MVC

Database System: EF Core (SQL Server

Tiered (for MVC) or Auth Server Separated (for Angular): no

Exception message and full stack trace:

Steps to reproduce the issue:

1、use abp suite build entity A,Master type 2、use abp suite build entity B,Child type,set parent is A 3、run system. Create A , And then Create B,but the B save button is no response


4 Answer(s)
  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi, I could reproduce the problem that you mentioned and created an internal issue for it. This occurs if your master entity has a name such as EntityA (I mean a pascalcase name). For a quick workaround, you can search in your application the word $(this).data("<yourentityname>-id") and replace the <yourentityname> placeholder with your entity name as lowercase.

    BTW, I refunded your ticket, thanks for reporting this problem.

  • User Avatar
    0
    829098@qq.com created

    hi

    Please use English to describe the problem. Our suite colleagues will check the problem.

    ABP Framework version: v8.0.1

    UI Type: MVC

    Database System: EF Core (SQL Server

    Tiered (for MVC) or Auth Server Separated (for Angular): no

    Exception message and full stack trace:

    Steps to reproduce the issue:

    1、use abp suite build entity A,Master type 2、use abp suite build entity B,Child type,set parent is A 3、run system. Create A , And then Create B,but the B save button is no response

    when I search in my application the word $(this).data("projectFlowing-id") and replace the projectflowing placeholder with your entity name as lowercase. the save function can response, but has one inner exception.

    2024-01-11 17:44:13.980 +08:00 [ERR] An error occurred while saving the entity changes. See the inner exception for details. Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.SqlClient.SqlException (0x80131904): INSERT 语句与 FOREIGN KEY 约束"FK_AppFlowingReports_AppProjectFlowings_ProjectFlowingId"冲突。该冲突发生于数据库"ProjectReward",表"dbo.AppProjectFlowings", column 'Id'。 语句已终止。

    AppProjectFlowings is Parent Table。 AppFlowingReports is child Table。

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    I have opened a PR to fix this problem:


    2024-01-11 17:44:13.980 +08:00 [ERR] An error occurred while saving the entity changes. See the inner exception for details. Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.SqlClient.SqlException (0x80131904): INSERT 语句与 FOREIGN KEY 约束"FK_AppFlowingReports_AppProjectFlowings_ProjectFlowingId"冲突。该冲突发生于数据库"ProjectReward",表"dbo.AppProjectFlowings", column 'Id'。 语句已终止。

    From the stack trace, it seems it can't add a record because it violates foreign key constraint, please check your entity configuration and the database.

  • User Avatar
    0
    829098@qq.com created

    I have opened a PR to fix this problem:


    2024-01-11 17:44:13.980 +08:00 [ERR] An error occurred while saving the entity changes. See the inner exception for details. Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.SqlClient.SqlException (0x80131904): INSERT 语句与 FOREIGN KEY 约束"FK_AppFlowingReports_AppProjectFlowings_ProjectFlowingId"冲突。该冲突发生于数据库"ProjectReward",表"dbo.AppProjectFlowings", column 'Id'。 语句已终止。

    From the stack trace, it seems it can't add a record because it violates foreign key constraint, please check your entity configuration and the database.

    ok,thks

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38