using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; using StopShopping.EF; using StopShopping.Services; using StopShopping.Services.Extensions; using StopShopping.Services.Implementions; namespace Microsoft.Extensions.DependencyInjection; public static class ServicesExtensions { public static IServiceCollection AddServices( this IServiceCollection services, Action dbContextOptions, IConfiguration appOptions, IConfiguration openPlatformOptions) { services.AddDbContext(dbContextOptions); services.Configure(appOptions); services.AddHttpClient(Consts.FILE_API_CLIENT_NAME, (sp, client) => { var options = sp.GetRequiredService>(); client.BaseAddress = new Uri(options.Value.FileApiLocalDomain); }); services.AddSingleton(); services.AddSingleton(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddOpenPlatformServices(openPlatformOptions); return services; } }