aspnetcore/src/Microsoft.AspNetCore.Signal.../RedisDependencyInjectionExt...

25 lines
849 B
C#

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.SignalR;
using Microsoft.AspNetCore.SignalR.Redis;
namespace Microsoft.Extensions.DependencyInjection
{
public static class RedisDependencyInjectionExtensions
{
public static ISignalRBuilder AddRedis(this ISignalRBuilder builder)
{
return AddRedis(builder, o => { });
}
public static ISignalRBuilder AddRedis(this ISignalRBuilder builder, Action<RedisOptions> configure)
{
builder.Services.Configure(configure);
builder.Services.AddSingleton(typeof(HubLifetimeManager<>), typeof(RedisHubLifetimeManager<>));
return builder;
}
}
}