Skip to content

Commit

Permalink
Merge branch 'master' of github.com:imperugo/StackExchange.Redis.Exte…
Browse files Browse the repository at this point in the history
…nsions
  • Loading branch information
imperugo committed Jun 17, 2020
2 parents 2e5fe8f + 4f35afe commit 8f9f1a5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The idea of this library is to make easier your live when you need to send / rec



[Documentation](https://stackexchange-redis-extensinos.gitbook.io/stackexchange-redis-extensions/) is composed of articles and guidance detailing how to get the most out of StackExchange.Redis.Extensions
[Documentation](https://app.gitbook.com/@imperugo/s/stackexchange-redis-extensions/) is composed of articles and guidance detailing how to get the most out of StackExchange.Redis.Extensions



Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using StackExchange.Redis;
using System;
using StackExchange.Redis;
using StackExchange.Redis.Extensions.Core;
using StackExchange.Redis.Extensions.Core.Abstractions;
using StackExchange.Redis.Extensions.Core.Configuration;
Expand All @@ -17,7 +18,23 @@ public static class IServiceCollectionExtensions
/// <param name="services">The service collection.</param>
/// <param name="redisConfiguration">The redis configration.</param>
/// <typeparam name="T">The typof of serializer. <see cref="ISerializer" />.</typeparam>
public static IServiceCollection AddStackExchangeRedisExtensions<T>(this IServiceCollection services, RedisConfiguration redisConfiguration)
public static IServiceCollection AddStackExchangeRedisExtensions<T>(
this IServiceCollection services,
RedisConfiguration redisConfiguration)
where T : class, ISerializer, new()
{
return services.AddStackExchangeRedisExtensions<T>(sp => redisConfiguration);
}

/// <summary>
/// Add StackExchange.Redis with its serialization provider.
/// </summary>
/// <param name="services">The service collection.</param>
/// <param name="redisConfigurationFactory">The redis configration factory.</param>
/// <typeparam name="T">The typof of serializer. <see cref="ISerializer" />.</typeparam>
public static IServiceCollection AddStackExchangeRedisExtensions<T>(
this IServiceCollection services,
Func<IServiceProvider, RedisConfiguration> redisConfigurationFactory)
where T : class, ISerializer, new()
{
services.AddSingleton<IRedisCacheClient, RedisCacheClient>();
Expand All @@ -29,7 +46,7 @@ public static IServiceCollection AddStackExchangeRedisExtensions<T>(this IServic
return provider.GetRequiredService<IRedisCacheClient>().GetDbFromConfiguration();
});

services.AddSingleton(redisConfiguration);
services.AddSingleton(redisConfigurationFactory);

return services;
}
Expand Down

0 comments on commit 8f9f1a5

Please sign in to comment.