diff --git a/Lazy.Captcha.Redis/Lazy.Captcha.Redis.csproj b/Lazy.Captcha.Redis/Lazy.Captcha.Redis.csproj deleted file mode 100644 index 3c17b0291df0189da3e13e0bd48978c015ad66cd..0000000000000000000000000000000000000000 --- a/Lazy.Captcha.Redis/Lazy.Captcha.Redis.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - netstandard2.1 - 仿EasyCaptcha和SimpleCaptcha,基于.Net Standard 2.1的图形验证码模块。Redis存储 - https://gitee.com/pojianbing/lazy-captcha - https://gitee.com/pojianbing/lazy-captcha - git - 1.0.8 - 1.0.8 - - - - - - - - - - - diff --git a/Lazy.Captcha.Redis/RedisCacheCaptchaExtensions.cs b/Lazy.Captcha.Redis/RedisCacheCaptchaExtensions.cs deleted file mode 100644 index 5a5b48e27bec81cafe378d2274d359e87a17803f..0000000000000000000000000000000000000000 --- a/Lazy.Captcha.Redis/RedisCacheCaptchaExtensions.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Lazy.Captcha.Core; -using Lazy.Captcha.Core.Storage; -using Lazy.Captcha.Core.Storeage; -using Microsoft.Extensions.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static class RedisCacheCaptchaExtensions - { - /// - /// 即将弃用,调整为直接使用 AddCache(),并且配置 AddStackExchangeRedisCache,参考 https://docs.microsoft.com/zh-cn/aspnet/core/performance/caching/distributed?view=aspnetcore-6.0#distributed-redis-cache - /// - [Obsolete("调整为直接使用 AddCache(),使用 Redis 缓存时配置 AddStackExchangeRedisCache,参考 https://docs.microsoft.com/zh-cn/aspnet/core/performance/caching/distributed?view=aspnetcore-6.0#distributed-redis-cache",false)] - public static IServiceCollection AddRedisCacheCaptcha(this IServiceCollection services, IConfiguration configuration, Action optionsAction = default!, string connName = null!) - { - var connStr = configuration.GetConnectionString(connName ?? "RedisCache"); - if (string.IsNullOrEmpty(connStr)) - { - throw new Exception("Please set connection string for key `RedisCache` in setting json file"); - } - services.AddCaptcha(configuration, optionsAction); - return services.AddStackExchangeRedisCache(options => - { - options.Configuration = connStr; - options.InstanceName = "captcha:"; - }); - } - } -} \ No newline at end of file diff --git a/Lazy.Captcha.Web/Lazy.Captcha.Web.csproj b/Lazy.Captcha.Web/Lazy.Captcha.Web.csproj index 90c6c6ad3ebb0b5b46f7d5c5a3856b72a78db31e..6dfa698781fbc7a1c6392a3584e968d1e47fc689 100644 --- a/Lazy.Captcha.Web/Lazy.Captcha.Web.csproj +++ b/Lazy.Captcha.Web/Lazy.Captcha.Web.csproj @@ -21,13 +21,13 @@ + - diff --git a/Lazy.Captcha.Web/Program.cs b/Lazy.Captcha.Web/Program.cs index 64e980ff36805df3b7c60844e6977bf447d55945..f0455994d990a45145900dcba48a75e8f5a16b52 100644 --- a/Lazy.Captcha.Web/Program.cs +++ b/Lazy.Captcha.Web/Program.cs @@ -5,7 +5,6 @@ using Microsoft.Extensions.DependencyInjection.Extensions; var builder = WebApplication.CreateBuilder(args); - // ڴ洢 appsettings.json builder.Services.AddCaptcha(builder.Configuration, options => { @@ -16,13 +15,24 @@ builder.Services.AddCaptcha(builder.Configuration, options => // 룬עͼɡ //builder.Services.Add(ServiceDescriptor.Scoped()); -// ʹredis棬 +// CoreĿʹõIDistributedCache +// ʹredis棬Ҫװ Microsoft.Extensions.Caching.StackExchangeRedis +// οhttps://docs.microsoft.com/zh-cn/aspnet/core/performance/caching/distributed //builder.Services.AddStackExchangeRedisCache(options => //{ // options.Configuration = builder.Configuration.GetConnectionString("RedisCache"); // options.InstanceName = "captcha:"; //}); +// CoreĿʹõIDistributedCache +// ʹSQLServer棬װ Microsoft.Extensions.Caching.SqlServer +//builder.Services.AddDistributedSqlServerCache(options => +//{ +// options.ConnectionString = builder.Configuration.GetConnectionString( +// "DistCache_ConnectionString"); +// options.SchemaName = "dbo"; +// options.TableName = "TestCache"; +//}); // ----------------------------------------------------------------------------- // ȫòڴ diff --git a/LazyCaptcha.sln b/LazyCaptcha.sln index 12fc6048a82fcf76b44a0480868b65fd52712888..6928fd63f3ff91c9e1b4974fd9f2b150ddaee70b 100644 --- a/LazyCaptcha.sln +++ b/LazyCaptcha.sln @@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lazy.Captcha.Core", "Lazy.C EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lazy.Captcha.Web", "Lazy.Captcha.Web\Lazy.Captcha.Web.csproj", "{18C83A51-3ECB-44FE-8ED4-62F59967487B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lazy.Captcha.Redis", "Lazy.Captcha.Redis\Lazy.Captcha.Redis.csproj", "{EC32628E-195E-4277-8026-EFAFA571432A}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lazy.Captcha.xUnit", "Lazy.Captcha.xUnit\Lazy.Captcha.xUnit.csproj", "{4E63EE78-CE03-4D89-BF86-7AF2247082F2}" EndProject Global @@ -25,10 +23,6 @@ Global {18C83A51-3ECB-44FE-8ED4-62F59967487B}.Debug|Any CPU.Build.0 = Debug|Any CPU {18C83A51-3ECB-44FE-8ED4-62F59967487B}.Release|Any CPU.ActiveCfg = Release|Any CPU {18C83A51-3ECB-44FE-8ED4-62F59967487B}.Release|Any CPU.Build.0 = Release|Any CPU - {EC32628E-195E-4277-8026-EFAFA571432A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EC32628E-195E-4277-8026-EFAFA571432A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EC32628E-195E-4277-8026-EFAFA571432A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EC32628E-195E-4277-8026-EFAFA571432A}.Release|Any CPU.Build.0 = Release|Any CPU {4E63EE78-CE03-4D89-BF86-7AF2247082F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4E63EE78-CE03-4D89-BF86-7AF2247082F2}.Debug|Any CPU.Build.0 = Debug|Any CPU {4E63EE78-CE03-4D89-BF86-7AF2247082F2}.Release|Any CPU.ActiveCfg = Release|Any CPU