public static void AddRedisContext <T>(this IServiceCollection services, Action <RedisContextOptions> options) where T : RedisContext { RedisContextOptions opt = new RedisContextOptions(); options(opt); services.AddSingleton(opt); services.AddScoped <T>(); }
protected RedisContext(RedisContextOptions options) { _options = options; Connect(); SetContext(); }