You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
950 B
33 lines
950 B
using Connected.Annotations;
|
|
using Connected.Caching.Net;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
[assembly: MicroService(MicroServiceType.Sys)]
|
|
|
|
namespace Connected.Caching;
|
|
|
|
internal class CachingStartup : Startup
|
|
{
|
|
public const string CachingHub = "/caching";
|
|
|
|
protected override void OnConfigure(WebApplication app)
|
|
{
|
|
app.MapHub<CacheHub>(CachingHub);
|
|
}
|
|
|
|
protected override void OnConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddSingleton(typeof(CacheServer));
|
|
services.AddSingleton(typeof(CacheServerConnection));
|
|
services.AddSingleton(typeof(ICachingService), typeof(CachingService));
|
|
services.AddScoped(typeof(ICacheContext), typeof(CacheContext));
|
|
}
|
|
|
|
protected override async Task OnInitialize(Dictionary<string, string> args)
|
|
{
|
|
if (Services is not null && Services.GetService<ICachingService>() is ICachingService service)
|
|
await service.Initialize();
|
|
}
|
|
}
|