Closed win32nipuh closed 3 years ago
hi @win32nipuh
Can you post your dbcontext
class as well as your customer entity class?
The "where" clause is coming from the global query filter Finbuckle.MultiTenant adds as a part of its core functionality--its how it isolates tenant data. If you don't want this behavior I can help you modify your context and entity class to not treat customers per-tenant.
Hey Andrew, I see. Ok, I will send the files. As I understand it is necessary to have that field in each table in case of using one database for all tenants. But I'd like to have separate databases. Btw, probably you can add some configuration parameter: to add the Tenantid field or do not.
@win32nipuh
Based on your email I would recommend that your db context NOT derive from MultiTenantDbContext
. It's main functionality is to support tenants sharing a database, but your use case is separate database per tenant.
In your case I recommend you inherit from the normal DbContext', inject the tenant info into the constructor, and set the connection in
OnConfiguringusing the tenant info
ConnectionString`.
Ok, by the way:
The DataIsolationSample uses 3 separate databases for 3 tenants. In fact: the field TenantId is not needed in the tables. IMHO, this sample can be divided to 2 or some configuration parameter can be used etc, you know better:
Hi, In the sample two of them should be sharing a single database and one should have it’s own. I’ll double check it today and maybe I can make it more clear. I think it might be clearer to have separate sample projects like you say but also to have the existing one-there are cases where you might have a mix of shared and separate databases.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I use latest FB preview, EF 3.1.4 for PostgreSQL. I am not sure what is the source of the problem but i receive the exception during query my Customers Set: Column does not exist: i.e. I see the query
The matter is: the field "TenantId" was added (why) to the correct query, but it is not in the table and naturally PostgreSQL error. Why the field "TenantId" is in the query? How I can fix it?