I managed to make it work in my project, thanks to the example provided by Svyatoslav Danyliv
, the references shared by Alexander Petrov
, and the help from the people in the comments. Thank you all!
Basically, what I needed to do was create a DbContext builder. This builder receives the company to be queried, constructs the connection string, and dynamically defines the table names to be queried (only the mapped ones, of course). In the end, it returns a DbContext referencing only the tables and database for that specific company.
I created a demo project for anyone who wants to test it out. If possible, feel free to submit pull requests with suggestions for improvements. I’ve never used EF Core in this way before, so there’s a chance it’s not implemented in the best way.