Open Closed

Custom ConnectionStringResolver Issue #9350


User avatar
0
Spospisil created

Hi,

I have implemented a custom ConnectionStringResolver class but the ICurrentTenant implementation does not resolve to the current logged in tenant. However I can't even get ABP's solutions to run even if I exclude this resolver class. At this point I have grown very tired of getting any sample projects to work to show support when I generate them using ABP tools, so I'll just give you the generated solution and you can figure out how to get it to run first and then we can have a discussion about the CurrentTenant issue I am having.

Can't waste yet another day trying to get a stock generated ABP solution to run

Steps to Reproduce:

  1. Get stock ABP generated solution to compile/run (Good luck as I've spend 2 days attempting to get it generated and to even work)
  2. Login in as host admin and create a Tenant of 'KENCO' with a non-shared DB (tenant has their own db)
  3. Login in as the KENCO tenant admin
  4. Monitor the debug messages I've added to the CFDMultiTenantConnectionStringResolver.cs class
  5. Observe the CurrentTenant variable still being set to null
  6. I've not been able to verify this test project will reproduce the issue I am experiencing as I've stated above I can't even get the ABP tool generated solution to compile/run

https://github.com/spospisil/ABPSampleTenant.git


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

    Your problem is that the middleware order is wrong. Nothing to do with IMultiTenant

    Please confirm your problem has been fixed with https://github.com/spospisil/ABP9Integration/commit/9e61bf3a5c2d9444d2c8a37b5250d998d7b3371e

  • User Avatar
    0
    Spospisil created

    Come on Maliming!!! Now you're saying something completely different then what you originally did!!! Do you understand why I'm just so frustrated with your responses. I ask you specific questions so I can understand why the ABP framework works the way it does and you ignore the question the first 2 times and then when you finally respond to the specific question you say something completely different regarding the root cause of my issue. I would not have asked my question 3 times had you just told me what the core issue was to begin with!

    Look back on your responses!!!! First you tell me it's because I didn't implement the IMultiTenant interface for an entity that isn't even used on the Company Management screen now you tell me it has nothing to do with IMultiTenant?

    Not really happy with the support we get from ABP!!

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    I'm sorry, the project you shared earlier is not the same as your real project. I can only troubleshoot the problem based on the code.

  • User Avatar
    0
    Spospisil created

    I'm sorry Maliming, but the code I gave you access to on Git yesterday was the same code you you commented back on today. I don't buy your excuse regarding this. You told me two different answers in a matter of 90 minutes while you were looking at the latest code that you had access to and that was only because I pressed on understanding the details. Please don't blame this on me.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You have a SWMultiTenantConnectionStringResolver service to output the Current Tenant info to logs,

    if (string.IsNullOrEmpty(_currentTenant.Id.ToString()))
    {
        _logger.LogCritical($"******* Current Tenant IS NOT resolved *******");
    }
    else
    {
        _logger.LogCritical($"******* Current Tenant IS resolved *******");
    }
    

    if your entity(eg, UserPermissionView) is not implemented with the IMultiTenant interface, the currentTenant will be null even if there is a tenant claim

    This reply is to clarify your output info. To avoid any misunderstanding on your part, that is, the current user has a tenant id claim, but the current tenant is null.


    Middleware problems are found by debugging your apps.

    https://github.com/spospisil/ABP9Integration/commit/9e61bf3a5c2d9444d2c8a37b5250d998d7b3371e

  • User Avatar
    0
    Spospisil created

    Now you're just responding with nonsense. Not even going to try to understand what you're saying now.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    I apologize for this. I'll explain patiently next time. Thanks.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 01, 2025, 08:37