i take it MyDbContext : EFCoreStoreDbContext<TenantInfo>, IMultiTenantDbContext is a mistake? #629
-
hello; congrats again for filling a multitenancy gap in the entire .net stack with our first year compsci hats on, given it's been a while for me, is it supported for custom stores to participate in ef core tenant isolation? seems the obvious risk is the store triggers tenant resolution which looks in the store which triggers tenant resolution infinitely but it would be good if the scenario could be definitevely shot down please advise |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, usually the tenant store itself is not "multitenant" although in some rare situations that might be feasible. Rather than an infinite loop what would usually happen is that the store raises an exception because it was unable to inject the the If this is something you want to try I recommend separating out the tenant resolution for the store itself. you can instantiate |
Beta Was this translation helpful? Give feedback.
Hi, usually the tenant store itself is not "multitenant" although in some rare situations that might be feasible. Rather than an infinite loop what would usually happen is that the store raises an exception because it was unable to inject the the
ITenantInfo
.If this is something you want to try I recommend separating out the tenant resolution for the store itself. you can instantiate
TenantResolver
and loop through itsIMultiTenantStrategies
to find a likely identifier then use to instantiate the store to be used in the ASP.NET Middleware. This logic would need to be in the store constructor or a factory method used for injecting the store.