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.
40 lines
1.2 KiB
40 lines
1.2 KiB
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<string, string> args)
|
|
{
|
|
if (Services is null || Services.GetService<IContextProvider>() is not IContextProvider provider)
|
|
return;
|
|
|
|
using var ctx = provider.Create();
|
|
|
|
if (ctx.GetService<IEndpointService>() is not IEndpointService endpoints || ctx.GetService<IEndpointServer>() is not IEndpointServer server)
|
|
return;
|
|
|
|
await server.Initialize(await endpoints.Query(), ctx.CancellationToken);
|
|
}
|
|
}
|
|
}
|