Ejemplo n.º 1
0
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();

        // works with VCAP_SERVICES JSON value added to config.json when running locally,
        // and works with actual VCAP_SERVICES env var based on configuration set above when running in CF
        var creds = new CloudantDotNet.Models.Creds()
        {
            username = Configuration["cloudantNoSQLDB:0:credentials:username"],
            password = Configuration["cloudantNoSQLDB:0:credentials:password"],
            host = Configuration["cloudantNoSQLDB:0:credentials:host"]
        };
        services.AddSingleton(typeof(CloudantDotNet.Models.Creds), creds);
        services.AddTransient<ICloudantService, CloudantService>();
    }
Ejemplo n.º 2
0
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();

        // works with VCAP_SERVICES JSON value added to config.json when running locally,
        // and works with actual VCAP_SERVICES env var based on configuration set above when running in CF
        var creds = new CloudantDotNet.Models.Creds()
        {
            username = Configuration["cloudantNoSQLDB:0:credentials:username"],
            password = Configuration["cloudantNoSQLDB:0:credentials:password"],
            host     = Configuration["cloudantNoSQLDB:0:credentials:host"]
        };

        services.AddSingleton(typeof(CloudantDotNet.Models.Creds), creds);
        services.AddTransient <ICloudantService, CloudantService>();
    }
Ejemplo n.º 3
0
 public CloudantService(Creds creds)
 {
     _cloudantCreds = creds;
 }