using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WinForm { [DependsOn( typeof(AbpAutofacModule), typeof(AbpAutoMapperModule), typeof(AbpHttpClientModule), typeof(FmpApplicationContractsModule), typeof(AbpHttpClientIdentityModelModule), typeof(AbpIdentityHttpApiClientModule) )] public class WinFormModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddHttpClientProxies( typeof(FmpApplicationContractsModule).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; }); } } }