C
C#5mo ago
Colton.dart

✅ Hybrid MultiTenancy with aspnet and efcore

I've developed a functional solution, but it's overly abstract. Currently, most elements reference User<TenantType>. I'd appreciate if someone could review my code and suggest resources or modifications to improve it. I've been working on this for 24 hours and could use some fresh perspective.
5 Replies
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Colton.dart
Colton.dartOP5mo ago
My apologies @TeBeCo, I've been working on this problem for quite a while and may have been unintentionally vague. Let me clarify: I have a claim that specifies a company/tenant, which works fine. My challenge lies in trying to dynamically access the DbSets based on the tenant type/DbContext. Currently, I have three DbContexts (one per tenant), and I'm aiming to minimize code duplication in my repository layer. Ideally, I'd like to use an annotation or a namespace to get the correct DbSet. As a beginner, I'm still learning, so please let me know if any part of my explanation needs further clarification.
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
phantomlord127
phantomlord1275mo ago
I personally use a BaseDbContext with all DbSets. Then I have 3 DbSets witch deduce from the Base and only set the tennant filter and/or connection string. If I want some data, I have an other class with a function to choose the right DbContext.
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server