diff --git a/build/releasenotes.props b/build/releasenotes.props index 9c2204f1..1fe50f01 100644 --- a/build/releasenotes.props +++ b/build/releasenotes.props @@ -1,13 +1,13 @@ + 1. Support IServiceProvider in setupActions 1. Upgrading dependencies. - 1. Fixed redis distributed lock for different process. - 2. Support code configuration for StackExchange.Redis. + 1. Upgrading dependencies. 1. Upgrading dependencies. @@ -40,26 +40,22 @@ 1. Upgrading dependencies. - 1. Support async version of subscribe. + 1. Upgrading dependencies. - 1. Support code configuration for StackExchange.Redis. - 2. Support async version of subscribe. - 3. fix: Using IConfiguration for WithRedisBus configuration cause DefaultRedisBus throw "Sequence contains no matching element" exception + 1. Upgrading dependencies. - 1. Support async version of subscribe. + 1. Upgrading dependencies. - 1. Support async version of subscribe. + 1. Upgrading dependencies. - 1. Support async version of subscribe. - 2. Rename WithConfluentKafkaBus to WithZookeeeperBus. + 1. Upgrading dependencies. - 1. Support custom serializer. - 2. Fixed DiskCachingProvider async warning. + 1. Upgrading dependencies. 1. Upgrading dependencies. diff --git a/build/version.props b/build/version.props index 1508fa80..6b378a42 100644 --- a/build/version.props +++ b/build/version.props @@ -1,29 +1,29 @@ - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 - 1.9.9 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 + 1.9.1 diff --git a/docs/In-Memory.md b/docs/In-Memory.md index 76e44463..9174afba 100644 --- a/docs/In-Memory.md +++ b/docs/In-Memory.md @@ -46,7 +46,7 @@ public class Startup // below two settings are added in v0.8.0 // enable deep clone when reading object from cache or not, default value is true. EnableReadDeepClone = true, - // enable deep clone when writing object to cache or not, default valuee is false. + // enable deep clone when writing object to cache or not, default value is false. EnableWriteDeepClone = false, }; // the max random second will be added to cache's expiration, default value is 120 diff --git a/src/EasyCaching.Core/Configurations/EasyCachingServiceCollectionExtensions.cs b/src/EasyCaching.Core/Configurations/EasyCachingServiceCollectionExtensions.cs index a3f105bc..2873dad9 100644 --- a/src/EasyCaching.Core/Configurations/EasyCachingServiceCollectionExtensions.cs +++ b/src/EasyCaching.Core/Configurations/EasyCachingServiceCollectionExtensions.cs @@ -1,8 +1,8 @@ namespace Microsoft.Extensions.DependencyInjection { using EasyCaching.Core; - using EasyCaching.Core.Configurations; - using System; + using EasyCaching.Core.Configurations; + using System; /// /// EasyCaching service collection extensions. @@ -10,7 +10,7 @@ public static class EasyCachingServiceCollectionExtensions { /// - /// Adds the easycaching. + /// Adds the EasyCaching. /// /// The easy caching. /// Services. @@ -30,5 +30,38 @@ public static IServiceCollection AddEasyCaching(this IServiceCollection services return services; } + + /// + /// Adds the EasyCaching. + /// + /// The easy caching. + /// Services. + /// Setup action. + public static IServiceCollection AddEasyCaching(this IServiceCollection services, Action setupAction) + { + ArgumentCheck.NotNull(setupAction, nameof(setupAction)); + + // Options + services.AddSingleton(sp => + { + var options = new EasyCachingOptions(); + setupAction(sp, options); + return options; + }); + + // Extension services + services.AddSingleton(sp => + { + var options = sp.GetRequiredService(); + foreach (var serviceExtension in options.Extensions) + { + serviceExtension.AddServices(services); + } + + return options; + }); + + return services; + } } }