using Common.Documents; using Common.Globalization; using Common.Security.Identity; using Connected; using Connected.Annotations; using Connected.Globalization; using Connected.Net.Endpoints; using Connected.Net.Server; using Connected.Security.Identity; using Connected.ServiceModel; using Microsoft.Extensions.DependencyInjection; [assembly: MicroService(MicroServiceType.Service)] namespace Common { internal class CommonStartup : Startup { protected override void OnConfigureServices(IServiceCollection services) { services.AddScoped(typeof(IGlobalizationService), typeof(GlobalizationService)); services.AddScoped(typeof(IIdentityService), typeof(IdentityService)); services.AddTransient(typeof(IDocumentLocker<,>), typeof(DocumentLocker<,>)); } protected override async Task OnInitialize(Dictionary args) { if (Services is null || Services.GetService() is not IContextProvider provider) return; using var ctx = provider.Create(); if (ctx.GetService() is not IEndpointService endpoints || ctx.GetService() is not IEndpointServer server) return; await server.Initialize(await endpoints.Query(), ctx.CancellationToken); } } }