using API; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Autofac; using Volo.Abp.AutoMapper; using Volo.Abp.Http.Client; using Volo.Abp.Http.Client.IdentityModel; using Volo.Abp.Identity; using Volo.Abp.IdentityModel; using Volo.Abp.Modularity; namespace WinFormsApp { [DependsOn( typeof(AbpAutofacModule), typeof(AbpAutoMapperModule), typeof(AbpHttpClientModule), typeof(APIApplicationContractsModule), typeof(AbpHttpClientIdentityModelModule), typeof(AbpIdentityHttpApiClientModule) )] public class WinFormModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddHttpClientProxies( typeof(APIApplicationContractsModule).Assembly, remoteServiceConfigurationName: "Default" ); Configure(options => { options.AddMaps(); }); //var configuration = context.Services.GetConfiguration(); //ConfigureIdentityClientOption(context, configuration); //context.Services.AddSingleton(); // context.Services.AddSingleton(); } private static void ConfigureIdentityClientOption(ServiceConfigurationContext context, IConfiguration configuration) { var defaultClientConfiguration = new IdentityClientConfiguration( configuration["IdentityClients:Default:Authority"], configuration["IdentityClients:Default:Scope"], configuration["IdentityClients:Default:ClientId"], configuration["IdentityClients:Default:ClientSecret"], configuration["IdentityClients:Default:GrantType"], configuration["IdentityClients:Default:UserName"], configuration["IdentityClients:Default:UserPassword"], false, 1800 ); context.Services.AddOptions().Configure(option => { option.IdentityClients.Default = defaultClientConfiguration; }); } } }