-
-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor DI and improve nullability
BREAKING CHANGE: (I)MultiTenantContext and (I)TenantInfo are no longer available via DI. Use IMultiTenantContextAccessor instead. Also IMultiTenantContext nullability reworked and should never be null.
- Loading branch information
1 parent
e9940a7
commit eca24bf
Showing
30 changed files
with
430 additions
and
411 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
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
12 changes: 0 additions & 12 deletions
12
src/Finbuckle.MultiTenant/Abstractions/IMultiTenantConfigureNamedOptions.cs
This file was deleted.
Oops, something went wrong.
40 changes: 15 additions & 25 deletions
40
src/Finbuckle.MultiTenant/Abstractions/IMultiTenantContext.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 |
---|---|---|
@@ -1,55 +1,45 @@ | ||
// Copyright Finbuckle LLC, Andrew White, and Contributors. | ||
// Refer to the solution LICENSE file for more information. | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Finbuckle.MultiTenant; | ||
|
||
/// <summary> | ||
/// Non-generic interface for the multitenant context. | ||
/// Non-generic interface for the MultiTenantContext. | ||
/// </summary> | ||
public interface IMultiTenantContext | ||
{ | ||
/// <summary> | ||
/// Information about the tenant for this context. | ||
/// </summary> | ||
ITenantInfo? TenantInfo { get; } | ||
|
||
/// <summary> | ||
/// True if a non-null tenant has been resolved. | ||
/// True if a tenant has been resolved and TenantInfo is not null. | ||
/// </summary> | ||
bool HasResolvedTenant => TenantInfo != null; | ||
bool IsResolved { get; } | ||
|
||
/// <summary> | ||
/// Information about the multitenant strategies for this context. | ||
/// Information about the MultiTenant strategies for this context. | ||
/// </summary> | ||
StrategyInfo? StrategyInfo { get; } | ||
} | ||
|
||
|
||
|
||
/// <summary> | ||
/// Generic interface for the multitenant context. | ||
/// Generic interface for the multi-tenant context. | ||
/// </summary> | ||
/// <typeparam name="T">The ITenantInfo implementation type.</typeparam> | ||
public interface IMultiTenantContext<T> | ||
where T : class, ITenantInfo, new() | ||
/// <typeparam name="TTenantInfo">The ITenantInfo implementation type.</typeparam> | ||
public interface IMultiTenantContext<TTenantInfo> : IMultiTenantContext | ||
where TTenantInfo : class, ITenantInfo, new() | ||
{ | ||
/// <summary> | ||
/// Information about the tenant for this context. | ||
/// </summary> | ||
T? TenantInfo { get; set; } | ||
new TTenantInfo? TenantInfo { get; } | ||
|
||
/// <summary> | ||
/// Returns true if a non-null tenant has been resolved. | ||
/// </summary> | ||
bool HasResolvedTenant => TenantInfo != null; | ||
|
||
/// <summary> | ||
/// Information about the multitenant strategies for this context. | ||
/// </summary> | ||
StrategyInfo? StrategyInfo { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Information about the multitenant store(s) for this context. | ||
/// Information about the MultiTenant stores for this context. | ||
/// </summary> | ||
StoreInfo<T>? StoreInfo { get; set; } | ||
StoreInfo<TTenantInfo>? StoreInfo { get; set; } | ||
} |
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
9 changes: 9 additions & 0 deletions
9
src/Finbuckle.MultiTenant/Abstractions/IMultiTenantContextSetter.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,9 @@ | ||
namespace Finbuckle.MultiTenant.Abstractions; | ||
|
||
/// <summary> | ||
/// Interface used to set the MultiTenantContext. This is an implementation detail and not intended for general use. | ||
/// </summary> | ||
public interface IMultiTenantContextSetter | ||
{ | ||
IMultiTenantContext MultiTenantContext { set; } | ||
} |
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
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
Oops, something went wrong.