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(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 args) { if (Services is not null && Services.GetService() is ICachingService service) await service.Initialize(); } }