public void ConfigureServices(IServiceCollection services)
        {
            privateConfig.MapToPocoInService(services);

            services.AddLogging();

            services.AddTransient <IConfiguration>(provider => Configuration);

            services.AddDbContext <ApplicationContext>(options => options.UseNpgsql(Configuration.GetConnectionString("PostgreSQL")));

            services.AddDefaultIdentity <ApplicationUser>()
            .AddRoles <IdentityRole>()
            .AddEntityFrameworkStores <ApplicationContext>();


            services.Configure <CertificatConfigModel>(Configuration.GetSection("Certificat"));
            var certificatConfigModel = services.GetOption <CertificatConfigModel>();

            var apiOptions      = services.GetOption <ApiSettingModel>();
            var clientOptions   = services.GetOption <ClientSettingModel>();
            var identityOptions = services.GetOption <IdetitySettingModel>();
            var identities      = IdentityConfig.GetIdentities(identityOptions.Identities);

            var builder = services.AddIdentityServer()
                          .AddInMemoryIdentityResources(identities)
                          .AddInMemoryApiResources(ApiConfig.GetApis(apiOptions.Apies))
                          .AddInMemoryClients(ClientsConfig.GetClients(clientOptions))
                          .AddAspNetIdentity <ApplicationUser>()
                          .AddCertificat(Environment.IsDevelopment(), certificatConfigModel);

            //.AddProfileService<CustomProfileService>();


            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }