-
-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add multitenant db factory method (#896)
Adds `MultiTenantDbContext.Create` as a factory method to create tenant instances of a multi-tenant db context. BREAKING CHANGE: `MultiTenantDbContext` constructors accepting ITenantInfo removed, use `MultiTenantDbContext.Create` factory method
- Loading branch information
1 parent
0e164a8
commit 8728447
Showing
10 changed files
with
301 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/Finbuckle.MultiTenant/Internal/StaticMultiTenantContextAccessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Finbuckle.MultiTenant.Abstractions; | ||
|
||
namespace Finbuckle.MultiTenant.Internal; | ||
|
||
internal class StaticMultiTenantContextAccessor<TTenantInfo>(TTenantInfo? tenantInfo) | ||
: IMultiTenantContextAccessor<TTenantInfo> | ||
where TTenantInfo : class, ITenantInfo, new() | ||
{ | ||
IMultiTenantContext IMultiTenantContextAccessor.MultiTenantContext => MultiTenantContext; | ||
|
||
public IMultiTenantContext<TTenantInfo> MultiTenantContext { get; } = | ||
new MultiTenantContext<TTenantInfo> { TenantInfo = tenantInfo }; | ||
} |
Oops, something went wrong.