From 909f7c05565f69de8fed803d732607b7e17e978f Mon Sep 17 00:00:00 2001
From: wosperry <593281239@qq.com>
Date: Thu, 15 Sep 2022 11:26:26 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9C=A8Host=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE=E7=9A=84=E7=A4=BA=E4=BE=8B=EF=BC=8C=E7=A7=BB=E9=99=A4?=
=?UTF-8?q?=E6=97=A0=E7=94=A8=E7=9A=84Redis=E9=A1=B9=E7=9B=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Lazy.Captcha.Redis/Lazy.Captcha.Redis.csproj | 21 ------------
.../RedisCacheCaptchaExtensions.cs | 32 -------------------
Lazy.Captcha.Web/Lazy.Captcha.Web.csproj | 2 +-
Lazy.Captcha.Web/Program.cs | 14 ++++++--
LazyCaptcha.sln | 6 ----
5 files changed, 13 insertions(+), 62 deletions(-)
delete mode 100644 Lazy.Captcha.Redis/Lazy.Captcha.Redis.csproj
delete mode 100644 Lazy.Captcha.Redis/RedisCacheCaptchaExtensions.cs
diff --git a/Lazy.Captcha.Redis/Lazy.Captcha.Redis.csproj b/Lazy.Captcha.Redis/Lazy.Captcha.Redis.csproj
deleted file mode 100644
index 3c17b02..0000000
--- 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 5a5b48e..0000000
--- 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 90c6c6a..6dfa698 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 64e980f..f045599 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 12fc604..6928fd6 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
--
Gitee