From b15003f14c68c8e86fc54aae71d7b8390e67710a Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sun, 28 Apr 2024 09:36:34 -0600 Subject: [PATCH] =?UTF-8?q?"unchore:=20improve=20XML=20comments=20for=20al?= =?UTF-8?q?l=20public=20facing=20types=20and=20methods=E2=80=A6"=20(#817)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 61b374bf70bb1dfaba99caf3866cfcfa1ee7d609. --- src/Directory.Build.props | 1 + .../Abstractions/IMultiTenantContextSetter.cs | 6 - .../OptionsBuilderExtensions.cs | 141 ++---------------- .../ServiceCollectionExtensions.cs | 26 +--- .../MultiTenantException.cs | 11 +- .../MultiTenantOptions.cs | 16 +- .../Options/MultiTenantOptionsCache.cs | 8 +- src/Finbuckle.MultiTenant/StoreInfo.cs | 11 -- .../HttpRemoteStore/HttpRemoteStoreClient.cs | 15 -- .../InMemoryStore/InMemoryStoreOptions.cs | 11 -- .../Strategies/DelegateStrategy.cs | 13 -- .../Strategies/MultiTenantStrategyWrapper.cs | 19 --- .../Strategies/StaticStrategy.cs | 17 +-- src/Finbuckle.MultiTenant/StrategyInfo.cs | 10 -- src/Finbuckle.MultiTenant/TenantInfo.cs | 17 --- src/Finbuckle.MultiTenant/TenantResolver.cs | 13 -- test/Directory.Build.props | 4 +- 17 files changed, 31 insertions(+), 308 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 3d5a9604..a38ec55c 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -13,6 +13,7 @@ finbuckle;multitenant;multitenancy;aspnet;aspnetcore;entityframework;entityframework-core;efcore finbuckle-128x128.png true + CS1591 diff --git a/src/Finbuckle.MultiTenant/Abstractions/IMultiTenantContextSetter.cs b/src/Finbuckle.MultiTenant/Abstractions/IMultiTenantContextSetter.cs index 0b823fcf..f05a479b 100644 --- a/src/Finbuckle.MultiTenant/Abstractions/IMultiTenantContextSetter.cs +++ b/src/Finbuckle.MultiTenant/Abstractions/IMultiTenantContextSetter.cs @@ -5,11 +5,5 @@ namespace Finbuckle.MultiTenant.Abstractions; /// public interface IMultiTenantContextSetter { - /// - /// Sets the MultiTenantContext. - /// - /// - /// The MultiTenantContext to be set. - /// IMultiTenantContext MultiTenantContext { set; } } \ No newline at end of file diff --git a/src/Finbuckle.MultiTenant/DependencyInjection/OptionsBuilderExtensions.cs b/src/Finbuckle.MultiTenant/DependencyInjection/OptionsBuilderExtensions.cs index a4aa6547..24605d9f 100644 --- a/src/Finbuckle.MultiTenant/DependencyInjection/OptionsBuilderExtensions.cs +++ b/src/Finbuckle.MultiTenant/DependencyInjection/OptionsBuilderExtensions.cs @@ -11,22 +11,8 @@ // ReSharper disable once CheckNamespace namespace Finbuckle.MultiTenant; -/// -/// This static class provides extension methods for the OptionsBuilder class. -/// These methods allow for the configuration and post-configuration of options on a per-tenant basis. -/// Additional dependencies can also be included in the configuration. -/// public static class OptionsBuilderExtensions { - /// - /// Configures the options for a specific tenant. - /// - /// The type of options being configured. - /// The ITenantInfo implementation type. - /// The options builder. - /// The action used to configure the options. - /// The same options builder so that multiple calls can be chained. - /// Thrown when the configureOptions parameter is null. public static OptionsBuilder ConfigurePerTenant( this OptionsBuilder optionsBuilder, Action configureOptions) where TOptions : class @@ -42,7 +28,7 @@ public static OptionsBuilder ConfigurePerTenant sp.GetRequiredService>(), (options, mtcAccessor) => { - var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; if (tenantInfo is not null) configureOptions(options, tenantInfo); })); @@ -50,16 +36,6 @@ public static OptionsBuilder ConfigurePerTenant return optionsBuilder; } - /// - /// Configures the options for a specific tenant with an additional dependency. - /// - /// The type of options being configured. - /// The type of the additional dependency. - /// The ITenantInfo implementation type. - /// The options builder. - /// The action used to configure the options. - /// The same options builder so that multiple calls can be chained. - /// Thrown when the configureOptions parameter is null. public static OptionsBuilder ConfigurePerTenant( this OptionsBuilder optionsBuilder, Action configureOptions) where TOptions : class @@ -77,25 +53,14 @@ public static OptionsBuilder ConfigurePerTenant>(), (options, dep, mtcAccessor) => { - var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; if (tenantInfo is not null) configureOptions(options, dep, tenantInfo); })); return optionsBuilder; } - - /// - /// Configures the options for a specific tenant with two additional dependencies. - /// - /// The type of options being configured. - /// The type of the first additional dependency. - /// The type of the second additional dependency. - /// The ITenantInfo implementation type. - /// The options builder. - /// The action used to configure the options. - /// The same options builder so that multiple calls can be chained. - /// Thrown when the configureOptions parameter is null. + public static OptionsBuilder ConfigurePerTenant( this OptionsBuilder optionsBuilder, Action configureOptions) where TOptions : class @@ -115,7 +80,7 @@ public static OptionsBuilder ConfigurePerTenant>(), (options, dep1, dep2, mtcAccessor) => { - var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; if (tenantInfo is not null) configureOptions(options, dep1, dep2, tenantInfo); })); @@ -123,18 +88,6 @@ public static OptionsBuilder ConfigurePerTenant - /// Configures the options for a specific tenant with two additional dependencies. - /// - /// The type of options being configured. - /// The type of the first additional dependency. - /// The type of the second additional dependency. - /// The type of the third additional dependency. - /// The ITenantInfo implementation type. - /// The options builder. - /// The action used to configure the options. - /// The same options builder so that multiple calls can be chained. - /// Thrown when the configureOptions parameter is null. public static OptionsBuilder ConfigurePerTenant( this OptionsBuilder optionsBuilder, Action configureOptions) @@ -157,7 +110,7 @@ public static OptionsBuilder ConfigurePerTenant>(), (options, dep1, dep2, dep3, mtcAccessor) => { - var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; if (tenantInfo is not null) configureOptions(options, dep1, dep2, dep3, tenantInfo); })); @@ -165,19 +118,6 @@ public static OptionsBuilder ConfigurePerTenant - /// Configures the options for a specific tenant with two additional dependencies. - /// - /// The type of options being configured. - /// The type of the first additional dependency. - /// The type of the second additional dependency. - /// The type of the third additional dependency. - /// The type of the fourth additional dependency. - /// The ITenantInfo implementation type. - /// The options builder. - /// The action used to configure the options. - /// The same options builder so that multiple calls can be chained. - /// Thrown when the configureOptions parameter is null. public static OptionsBuilder ConfigurePerTenant( this OptionsBuilder optionsBuilder, Action configureOptions) @@ -202,7 +142,7 @@ public static OptionsBuilder ConfigurePerTenant>(), (options, dep1, dep2, dep3, dep4, mtcAccessor) => { - var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; if (tenantInfo is not null) configureOptions(options, dep1, dep2, dep3, dep4, tenantInfo); })); @@ -238,7 +178,7 @@ public static OptionsBuilder ConfigurePerTenant(), // (options, dep1, dep2, dep3, dep4, dep5) => // { - // var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + // var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; // if (tenantInfo is not null) // configureOptions(options, dep1, dep2, dep3, dep4, dep5, tenantInfo); // }); @@ -247,15 +187,6 @@ public static OptionsBuilder ConfigurePerTenant - /// Post-configures the options for a specific tenant. - /// - /// The type of options being post-configured. - /// The ITenantInfo implementation type. - /// The options builder. - /// The action used to post-configure the options. - /// The same options builder so that multiple calls can be chained. - /// Thrown when the configureOptions parameter is null. public static OptionsBuilder PostConfigurePerTenant( this OptionsBuilder optionsBuilder, Action configureOptions) where TOptions : class @@ -271,7 +202,7 @@ public static OptionsBuilder PostConfigurePerTenant>(), (options, mtcAccessor) => { - var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; if (tenantInfo is not null) configureOptions(options, tenantInfo); })); @@ -279,16 +210,6 @@ public static OptionsBuilder PostConfigurePerTenant - /// Post-configures the options for a specific tenant. - /// - /// The type of options being post-configured. - /// The type of the additional dependency. - /// The ITenantInfo implementation type. - /// The options builder. - /// The action used to post-configure the options. - /// The same options builder so that multiple calls can be chained. - /// Thrown when the configureOptions parameter is null. public static OptionsBuilder PostConfigurePerTenant( this OptionsBuilder optionsBuilder, Action configureOptions) where TOptions : class @@ -306,7 +227,7 @@ public static OptionsBuilder PostConfigurePerTenant>(), (options, dep, mtcAccessor) => { - var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; if (tenantInfo is not null) configureOptions(options, dep, tenantInfo); })); @@ -314,17 +235,6 @@ public static OptionsBuilder PostConfigurePerTenant - /// Post-configures the options for a specific tenant. - /// - /// The type of options being post-configured. - /// The type of the first additional dependency. - /// The type of the second additional dependency. - /// The ITenantInfo implementation type. - /// The options builder. - /// The action used to post-configure the options. - /// The same options builder so that multiple calls can be chained. - /// Thrown when the configureOptions parameter is null. public static OptionsBuilder PostConfigurePerTenant( this OptionsBuilder optionsBuilder, Action configureOptions) where TOptions : class @@ -344,7 +254,7 @@ public static OptionsBuilder PostConfigurePerTenant>(), (options, dep1, dep2, mtcAccessor) => { - var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; if (tenantInfo is not null) configureOptions(options, dep1, dep2, tenantInfo); })); @@ -352,18 +262,6 @@ public static OptionsBuilder PostConfigurePerTenant - /// Post-configures the options for a specific tenant. - /// - /// The type of options being post-configured. - /// The type of the first additional dependency. - /// The type of the second additional dependency. - /// The type of the third additional dependency. - /// The ITenantInfo implementation type. - /// The options builder. - /// The action used to post-configure the options. - /// The same options builder so that multiple calls can be chained. - /// Thrown when the configureOptions parameter is null. public static OptionsBuilder PostConfigurePerTenant( this OptionsBuilder optionsBuilder, Action configureOptions) @@ -386,7 +284,7 @@ public static OptionsBuilder PostConfigurePerTenant>(), (options, dep1, dep2, dep3, mtcAccessor) => { - var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; if (tenantInfo is not null) configureOptions(options, dep1, dep2, dep3, tenantInfo); })); @@ -394,19 +292,6 @@ public static OptionsBuilder PostConfigurePerTenant - /// Post-configures the options for a specific tenant. - /// - /// The type of options being post-configured. - /// The type of the first additional dependency. - /// The type of the second additional dependency. - /// The type of the third additional dependency. - /// The type of the fourth additional dependency. - /// The ITenantInfo implementation type. - /// The options builder. - /// The action used to post-configure the options. - /// The same options builder so that multiple calls can be chained. - /// Thrown when the configureOptions parameter is null. public static OptionsBuilder PostConfigurePerTenant( this OptionsBuilder optionsBuilder, Action configureOptions) @@ -431,7 +316,7 @@ public static OptionsBuilder PostConfigurePerTenant>(), (options, dep1, dep2, dep3, dep4, mtcAccessor) => { - var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; if (tenantInfo is not null) configureOptions(options, dep1, dep2, dep3, dep4, tenantInfo); })); @@ -468,7 +353,7 @@ public static OptionsBuilder PostConfigurePerTenant(), // (options, dep1, dep2, dep3, dep4, dep5) => // { - // var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + // var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; // if (tenantInfo is not null) // configureOptions(options, dep1, dep2, dep3, dep4, dep5, tenantInfo); // }); diff --git a/src/Finbuckle.MultiTenant/DependencyInjection/ServiceCollectionExtensions.cs b/src/Finbuckle.MultiTenant/DependencyInjection/ServiceCollectionExtensions.cs index 66cdf3a1..315348dd 100644 --- a/src/Finbuckle.MultiTenant/DependencyInjection/ServiceCollectionExtensions.cs +++ b/src/Finbuckle.MultiTenant/DependencyInjection/ServiceCollectionExtensions.cs @@ -13,16 +13,14 @@ namespace Finbuckle.MultiTenant; /// -/// This static class provides extension methods for the IServiceCollection interface. -/// These methods are used to configure Finbuckle.MultiTenant services for the application. +/// IServiceCollection extension methods for Finbuckle.MultiTenant. /// [SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")] public static class FinbuckleServiceCollectionExtensions { /// - /// Configures Finbuckle.MultiTenant services for the application. + /// Configure Finbuckle.MultiTenant services for the application. /// - /// The ITenantInfo implementation type. /// The IServiceCollection instance the extension method applies to. /// An action to configure the MultiTenantOptions instance. /// A new instance of MultiTenantBuilder. @@ -33,7 +31,7 @@ public static MultiTenantBuilder AddMultiTenant(this I { services.AddScoped, TenantResolver>(); services.AddScoped( - sp => sp.GetRequiredService>()); + sp => (ITenantResolver)sp.GetRequiredService>()); services.AddSingleton, AsyncLocalMultiTenantContextAccessor>(); @@ -50,25 +48,17 @@ public static MultiTenantBuilder AddMultiTenant(this I } /// - /// Configures Finbuckle.MultiTenant services for the application. + /// Configure Finbuckle.MultiTenant services for the application. /// - /// The ITenantInfo implementation type. /// The IServiceCollection instance the extension method applies to. - /// A new instance of MultiTenantBuilder. + /// An new instance of MultiTenantBuilder. public static MultiTenantBuilder AddMultiTenant(this IServiceCollection services) where TTenantInfo : class, ITenantInfo, new() { return services.AddMultiTenant(_ => { }); } - /// - /// Decorates an existing service with a new implementation. - /// - /// The type of the service to be decorated. - /// The type of the new implementation. - /// The IServiceCollection instance the extension method applies to. - /// Additional parameters for the new implementation. - /// True if the decoration was successful, false otherwise. + // TODO: better document and extract public static bool DecorateService(this IServiceCollection services, params object[] parameters) { var existingService = services.SingleOrDefault(s => s.ServiceType == typeof(TService)); @@ -156,7 +146,7 @@ public static IServiceCollection ConfigurePerTenant( sp.GetRequiredService>(), (options, mtcAccessor) => { - var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; if (tenantInfo is not null) configureOptions(options, tenantInfo); })); @@ -221,7 +211,7 @@ public static IServiceCollection PostConfigurePerTenant( sp.GetRequiredService>(), (options, mtcAccessor) => { - var tenantInfo = mtcAccessor.MultiTenantContext.TenantInfo; + var tenantInfo = mtcAccessor.MultiTenantContext?.TenantInfo; if (tenantInfo is not null) configureOptions(options, tenantInfo); })); diff --git a/src/Finbuckle.MultiTenant/MultiTenantException.cs b/src/Finbuckle.MultiTenant/MultiTenantException.cs index c596b4de..638b70a6 100644 --- a/src/Finbuckle.MultiTenant/MultiTenantException.cs +++ b/src/Finbuckle.MultiTenant/MultiTenantException.cs @@ -4,23 +4,14 @@ namespace Finbuckle.MultiTenant; /// -/// Represents an exception that is thrown when an error occurs in the Finbuckle.MultiTenant library. +/// An exception generated by Finbuckle.MultiTenant. /// public class MultiTenantException : Exception { - /// - /// Initializes a new instance of the class with a specified error message. - /// - /// The message that describes the error. public MultiTenantException(string? message) : base(message) { } - /// - /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. - /// - /// The error message that explains the reason for the exception. - /// The exception that is the cause of the current exception, or a null reference if no inner exception is specified. public MultiTenantException(string? message, Exception? innerException) : base(message, innerException) { } diff --git a/src/Finbuckle.MultiTenant/MultiTenantOptions.cs b/src/Finbuckle.MultiTenant/MultiTenantOptions.cs index b89954e8..82a98354 100644 --- a/src/Finbuckle.MultiTenant/MultiTenantOptions.cs +++ b/src/Finbuckle.MultiTenant/MultiTenantOptions.cs @@ -7,23 +7,9 @@ namespace Finbuckle.MultiTenant; -/// -/// Represents the options for a multi-tenant application. -/// public class MultiTenantOptions { - /// - /// Gets or sets the type of the tenant information. - /// public Type? TenantInfoType { get; internal set; } - - /// - /// Gets or sets the list of identifiers that should be ignored. - /// public IList IgnoredIdentifiers { get; set; } = new List(); - - /// - /// Gets or sets the events that can be used to customize the multi-tenant application behavior. - /// - public MultiTenantEvents Events { get; set; } = new(); + public MultiTenantEvents Events { get; set; } = new (); } \ No newline at end of file diff --git a/src/Finbuckle.MultiTenant/Options/MultiTenantOptionsCache.cs b/src/Finbuckle.MultiTenant/Options/MultiTenantOptionsCache.cs index fa1da05f..2b57de2d 100644 --- a/src/Finbuckle.MultiTenant/Options/MultiTenantOptionsCache.cs +++ b/src/Finbuckle.MultiTenant/Options/MultiTenantOptionsCache.cs @@ -33,7 +33,7 @@ public MultiTenantOptionsCache(IMultiTenantContextAccessor multiTenantContextAcc /// public void Clear() { - var tenantId = multiTenantContextAccessor.MultiTenantContext.TenantInfo?.Id ?? ""; + var tenantId = multiTenantContextAccessor.MultiTenantContext?.TenantInfo?.Id ?? ""; var cache = map.GetOrAdd(tenantId, new OptionsCache()); cache.Clear(); @@ -73,7 +73,7 @@ public TOptions GetOrAdd(string? name, Func createOptions) } name ??= Microsoft.Extensions.Options.Options.DefaultName; - var tenantId = multiTenantContextAccessor.MultiTenantContext.TenantInfo?.Id ?? ""; + var tenantId = multiTenantContextAccessor.MultiTenantContext?.TenantInfo?.Id ?? ""; var cache = map.GetOrAdd(tenantId, new OptionsCache()); return cache.GetOrAdd(name, createOptions); @@ -88,7 +88,7 @@ public TOptions GetOrAdd(string? name, Func createOptions) public bool TryAdd(string? name, TOptions options) { name = name ?? Microsoft.Extensions.Options.Options.DefaultName; - var tenantId = multiTenantContextAccessor.MultiTenantContext.TenantInfo?.Id ?? ""; + var tenantId = multiTenantContextAccessor.MultiTenantContext?.TenantInfo?.Id ?? ""; var cache = map.GetOrAdd(tenantId, new OptionsCache()); return cache.TryAdd(name, options); @@ -102,7 +102,7 @@ public bool TryAdd(string? name, TOptions options) public bool TryRemove(string? name) { name = name ?? Microsoft.Extensions.Options.Options.DefaultName; - var tenantId = multiTenantContextAccessor.MultiTenantContext.TenantInfo?.Id ?? ""; + var tenantId = multiTenantContextAccessor.MultiTenantContext?.TenantInfo?.Id ?? ""; var cache = map.GetOrAdd(tenantId, new OptionsCache()); return cache.TryRemove(name); diff --git a/src/Finbuckle.MultiTenant/StoreInfo.cs b/src/Finbuckle.MultiTenant/StoreInfo.cs index 6b19e6f6..4cacc463 100644 --- a/src/Finbuckle.MultiTenant/StoreInfo.cs +++ b/src/Finbuckle.MultiTenant/StoreInfo.cs @@ -5,19 +5,8 @@ namespace Finbuckle.MultiTenant; -/// -/// Represents the store information for a specific tenant. -/// -/// The ITenantInfo implementation type. public class StoreInfo where TTenantInfo : class, ITenantInfo, new() { - /// - /// Gets or sets the type of the store. - /// public Type? StoreType { get; internal set; } - - /// - /// Gets or sets the multi-tenant store. - /// public IMultiTenantStore? Store { get; internal set; } } \ No newline at end of file diff --git a/src/Finbuckle.MultiTenant/Stores/HttpRemoteStore/HttpRemoteStoreClient.cs b/src/Finbuckle.MultiTenant/Stores/HttpRemoteStore/HttpRemoteStoreClient.cs index 9c8a0eca..6a1ef543 100644 --- a/src/Finbuckle.MultiTenant/Stores/HttpRemoteStore/HttpRemoteStoreClient.cs +++ b/src/Finbuckle.MultiTenant/Stores/HttpRemoteStore/HttpRemoteStoreClient.cs @@ -6,30 +6,15 @@ namespace Finbuckle.MultiTenant.Stores.HttpRemoteStore; -/// -/// The HttpRemoteStoreClient class is a generic class that is used to interact with a remote HTTP store. -/// -/// The ITenantInfo implementation type. public class HttpRemoteStoreClient where TTenantInfo : class, ITenantInfo, new() { private readonly IHttpClientFactory clientFactory; - /// - /// Initializes a new instance of the HttpRemoteStoreClient class. - /// - /// An instance of IHttpClientFactory. - /// Thrown when clientFactory is null. public HttpRemoteStoreClient(IHttpClientFactory clientFactory) { this.clientFactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory)); } - /// - /// Tries to get the tenant information by identifier from the remote HTTP store. - /// - /// The endpoint template to use when making the HTTP request. - /// The identifier of the tenant. - /// The tenant information if found; otherwise, null. public async Task TryGetByIdentifierAsync(string endpointTemplate, string identifier) { var client = clientFactory.CreateClient(typeof(HttpRemoteStoreClient).FullName!); diff --git a/src/Finbuckle.MultiTenant/Stores/InMemoryStore/InMemoryStoreOptions.cs b/src/Finbuckle.MultiTenant/Stores/InMemoryStore/InMemoryStoreOptions.cs index bc03f88a..5346fdfe 100644 --- a/src/Finbuckle.MultiTenant/Stores/InMemoryStore/InMemoryStoreOptions.cs +++ b/src/Finbuckle.MultiTenant/Stores/InMemoryStore/InMemoryStoreOptions.cs @@ -5,20 +5,9 @@ namespace Finbuckle.MultiTenant.Stores.InMemoryStore; -/// -/// Options for the InMemoryStore. -/// -/// The ITenantInfo implementation type. public class InMemoryStoreOptions where TTenantInfo : class, ITenantInfo, new() { - /// - /// Gets or sets a value indicating whether the InMemoryStore should be case sensitive. - /// public bool IsCaseSensitive { get; set; } - - /// - /// Gets or sets the list of tenants to be stored in the InMemoryStore. - /// public IList Tenants { get; set; } = new List(); } \ No newline at end of file diff --git a/src/Finbuckle.MultiTenant/Strategies/DelegateStrategy.cs b/src/Finbuckle.MultiTenant/Strategies/DelegateStrategy.cs index cc334236..567e7939 100644 --- a/src/Finbuckle.MultiTenant/Strategies/DelegateStrategy.cs +++ b/src/Finbuckle.MultiTenant/Strategies/DelegateStrategy.cs @@ -5,28 +5,15 @@ namespace Finbuckle.MultiTenant.Strategies; -/// -/// The DelegateStrategy class implements the IMultiTenantStrategy interface and uses a delegate to determine the tenant identifier. -/// public class DelegateStrategy : IMultiTenantStrategy { private readonly Func> _doStrategy; - /// - /// Initializes a new instance of the DelegateStrategy class. - /// - /// A delegate that encapsulates a method to determine the tenant identifier. - /// Thrown when doStrategy is null. public DelegateStrategy(Func> doStrategy) { _doStrategy = doStrategy ?? throw new ArgumentNullException(nameof(doStrategy)); } - /// - /// Asynchronously determines the tenant identifier using the encapsulated delegate. - /// - /// The context used by the delegate to determine the tenant identifier. - /// A task that represents the asynchronous operation. The task result contains the tenant identifier or null if not found. public async Task GetIdentifierAsync(object context) { var identifier = await _doStrategy(context); diff --git a/src/Finbuckle.MultiTenant/Strategies/MultiTenantStrategyWrapper.cs b/src/Finbuckle.MultiTenant/Strategies/MultiTenantStrategyWrapper.cs index ff9bf02d..35019654 100644 --- a/src/Finbuckle.MultiTenant/Strategies/MultiTenantStrategyWrapper.cs +++ b/src/Finbuckle.MultiTenant/Strategies/MultiTenantStrategyWrapper.cs @@ -6,37 +6,18 @@ namespace Finbuckle.MultiTenant.Strategies; -/// -/// Wraps an IMultiTenantStrategy and logs exceptions. -/// public class MultiTenantStrategyWrapper : IMultiTenantStrategy { - /// - /// Gets the IMultiTenantStrategy instance that this wrapper is wrapping. - /// public IMultiTenantStrategy Strategy { get; } private readonly ILogger logger; - /// - /// Initializes a new instance of the MultiTenantStrategyWrapper class. - /// - /// The IMultiTenantStrategy instance to wrap. - /// An instance of ILogger. - /// Thrown when strategy or logger is null. public MultiTenantStrategyWrapper(IMultiTenantStrategy strategy, ILogger logger) { this.Strategy = strategy ?? throw new ArgumentNullException(nameof(strategy)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); } - /// - /// Asynchronously determines the tenant identifier using the wrapped strategy. - /// - /// The context used by the strategy to determine the tenant identifier. - /// A task that represents the asynchronous operation. The task result contains the tenant identifier. - /// Thrown when context is null. - /// Thrown when an exception occurs in the wrapped strategy's GetIdentifierAsync method. public async Task GetIdentifierAsync(object context) { if (context == null) diff --git a/src/Finbuckle.MultiTenant/Strategies/StaticStrategy.cs b/src/Finbuckle.MultiTenant/Strategies/StaticStrategy.cs index 146c361b..56f7ad0a 100644 --- a/src/Finbuckle.MultiTenant/Strategies/StaticStrategy.cs +++ b/src/Finbuckle.MultiTenant/Strategies/StaticStrategy.cs @@ -5,32 +5,17 @@ namespace Finbuckle.MultiTenant.Strategies; -/// -/// The StaticStrategy class implements the IMultiTenantStrategy interface and provides a static identifier to determine the tenant. -/// public class StaticStrategy : IMultiTenantStrategy { internal readonly string Identifier; - /// - /// Gets the priority of the strategy. Strategies with higher priority are evaluated first. - /// public int Priority { get => -1000; } - - /// - /// Initializes a new instance of the StaticStrategy class. - /// - /// The static identifier used to determine the tenant. + public StaticStrategy(string identifier) { this.Identifier = identifier; } - /// - /// Asynchronously determines the tenant identifier using the static identifier. - /// - /// The context used by the strategy to determine the tenant identifier. In this case, it's not used. - /// A task that represents the asynchronous operation. The task result contains the tenant identifier. public async Task GetIdentifierAsync(object context) { return await Task.FromResult(Identifier); diff --git a/src/Finbuckle.MultiTenant/StrategyInfo.cs b/src/Finbuckle.MultiTenant/StrategyInfo.cs index cd8c96ce..e95702f7 100644 --- a/src/Finbuckle.MultiTenant/StrategyInfo.cs +++ b/src/Finbuckle.MultiTenant/StrategyInfo.cs @@ -5,18 +5,8 @@ namespace Finbuckle.MultiTenant; -/// -/// Contextual information about the stategy used to resolve the tenant. -/// public class StrategyInfo { - /// - /// - /// public Type? StrategyType { get; internal set; } - - /// - /// The strategy instance used to resolve the tenant. - /// public IMultiTenantStrategy? Strategy { get; internal set; } } \ No newline at end of file diff --git a/src/Finbuckle.MultiTenant/TenantInfo.cs b/src/Finbuckle.MultiTenant/TenantInfo.cs index 1e617b8d..92e8954b 100644 --- a/src/Finbuckle.MultiTenant/TenantInfo.cs +++ b/src/Finbuckle.MultiTenant/TenantInfo.cs @@ -6,24 +6,14 @@ namespace Finbuckle.MultiTenant; -/// -/// The TenantInfo class implements the ITenantInfo interface and represents a basic tenant in a multi-tenant application. -/// public class TenantInfo : ITenantInfo { private string? id; - /// - /// Initializes a new instance of the TenantInfo class. - /// public TenantInfo() { } - /// - /// Gets or sets the ID of the tenant. The setter validates the length of the ID. - /// - /// Thrown when the ID exceeds the maximum length. public string? Id { get @@ -43,13 +33,6 @@ public string? Id } } - /// - /// Gets or sets the identifier of the tenant. - /// public string? Identifier { get; set; } - - /// - /// Gets or sets the name of the tenant. - /// public string? Name { get; set; } } \ No newline at end of file diff --git a/src/Finbuckle.MultiTenant/TenantResolver.cs b/src/Finbuckle.MultiTenant/TenantResolver.cs index d4083801..4329bcf1 100644 --- a/src/Finbuckle.MultiTenant/TenantResolver.cs +++ b/src/Finbuckle.MultiTenant/TenantResolver.cs @@ -21,25 +21,12 @@ public class TenantResolver : ITenantResolver private readonly IOptionsMonitor options; private readonly ILoggerFactory? loggerFactory; - /// - /// Initializes a new instance of the TenantResolver class. - /// - /// A collection of IMultiTenantStrategy instances. - /// A collection of IMultiTenantStore instances. - /// An IOptionsMonitor instance for accessing MultiTenantOptions. public TenantResolver(IEnumerable strategies, IEnumerable> stores, IOptionsMonitor options) : this(strategies, stores, options, null) { } - /// - /// Initializes a new instance of the TenantResolver class with logging capabilities. - /// - /// A collection of IMultiTenantStrategy instances. - /// A collection of IMultiTenantStore instances. - /// An IOptionsMonitor instance for accessing MultiTenantOptions. - /// An ILoggerFactory instance for creating loggers. public TenantResolver(IEnumerable strategies, IEnumerable> stores, IOptionsMonitor options, ILoggerFactory? loggerFactory) diff --git a/test/Directory.Build.props b/test/Directory.Build.props index e322ed81..446c4915 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -1,8 +1,8 @@ - - + + \ No newline at end of file