Open Closed

Not able to Create/Update record in Tenant Database from Host login. #2776


User avatar
0
PravinRaijade created
  • ABP Framework version: v4.3.3
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"
  • Login as Host (tenantID = null)
  • create record for a table using generated Form.
  • in method = public async Task<IActionResult> OnPostAsync() added following code so that Table in Host DB and same table in Tenant DB should get updated.

using (CurrentTenant.Change(tenantId))
{ Guid tmp = CurrentTenant.GetId(); // this line is just to check whether tenant switched properly

          await _XXXXAppService.CreateAsync(MyEntityDto);
          return NoContent();
       }

getting correct tenant ID in using statement.

Note : I am using separate DB per tenant. appreciate your help.

Getting following error :

Failed to load resource: the server responded with a status of 500 () [https://192.168.254.51:44346/XXXXs/CreateModal]

Remember, I have separate DB per Tenant.

Need solution on URGENT basis.

Appreciate your help.


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    with a status of 500

    What's the details error?

  • User Avatar
    0
    PravinRaijade created

    HI Support,

    I could resolve the issue at my level.

    I was assuming that when we switch the Tenant using, "CurrentTenant.Change" and insert new record in tenant DB, the Guid of the record would be same as that of the host record before switch. (these master records and not host & tenant specific). This is more relevant when we have linked table using foreign key referential integrity. But, that assumption was wrong. Now, I am querying the Guid of linked table record (foreign table) from respective tenant DB and updating master record with appropriate Guid of child record and then calling "CreateAsync"

    If possible, could you please refund the credit points.

    Regards, Pravin Raijade.

  • User Avatar
    0
    PravinRaijade created

    I closed the ticket after writing my comments. so, that could be the reason, you missed my request for refund of credit.

    My request is, am I eligible for refund of credit as I resolved this issue at my level. if yes, could you please do the needful.

    Regards, Pravin Raijade.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

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