Finbuckle / Finbuckle.MultiTenant

Finbuckle.MultiTenant is an open-source multitenancy middleware library for .NET. It enables tenant resolution, per-tenant app behavior, and per-tenant data isolation.
https://www.finbuckle.com/multitenant
Apache License 2.0
1.3k stars 265 forks source link

Accessing entities from other tenants #130

Closed ericsports closed 5 years ago

ericsports commented 5 years ago

I have a need where I want to be able to access entities (including users, roles) from another tenant, that is one that is being set up to administer users and other items for other tenants. I very well could be doing this in the wrong approach, but was just wondering if there were a way for this sort of functionality?

Any help is much appreciated!

AndrewTriesToCode commented 5 years ago

Hi @ericsports

Are you using normal LINQ queries to try to access the entities that belong to other tenants?

If so this should be easy. Internally Finbuckle.MultiTenant sets a global query filter. This can easily be bypassed for a query as shown in this link: https://docs.microsoft.com/en-us/ef/core/querying/filters#disabling-filters

Let me know how it goes.

ericsports commented 5 years ago

That does the trick, thanks!