username@email.com
2025-02-05 d86bc04d0b34f2b7d9ddbd30ee703b51d48876e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using cylsg.Core;
using Furion;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace EzCoreNet.Redis
{
    /// <summary>
    /// 封装注册函数和配置函数
    /// </summary>
    public static class startup
    {
        public static void AddEzCoreNetRedisService(this IServiceCollection services, Action<opentions>? redisOptions = null)
        {
 
            opentions op = new opentions();
            if (redisOptions != null)
            {
                redisOptions.Invoke(op);
            }
            //只使用普通模式,其他后续开发
            var cs = new CSRedis.CSRedisClient(op.Configuration);
            //注入链接
            RedisHelper.Initialization(cs);
 
            services.AddScoped<IEzCoreNetRedisService, EzCoreNetRedisService>();
 
        }
    }
 
 
    public class RedisStartup : AppStartup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddEzCoreNetRedisService(op=>
            {
                op.Configuration = App.Configuration["RedisConfig:ConnectionString"];
            });
 
 
        }
 
    }
}