@etoilexxx Sorry for the confusion. I mean all of the code used to configure the Couchbase SDK and get access to the bucket object you’re using in your above example. For example, if you’re using Couchbase.Extensions.DependencyInjection then your ServiceCollection registration statements and your config.json file.
I am not using any couchbase extensions:
AppSetting.config:
“couchbase”: {
“ConnectionString”: “couchbase://localhost”,
“UserName”: “username”,
“Password”: “pass”,
“buckets”: [ “app-data” ]
}
Startup/Configure Services
var section = configuration.GetSection(“couchbase”);
services.Configure(options => configuration.GetSection(“couchbase”).Bind(options));
I’m not certain, but I’m not really sure how that bootstrap code you provided is working. For example, c.GetService<IOptions>().Value wouldn’t get the couchbase options object, it would need to be c.GetService<IOptions<ClusterOptions>>().Value. It also has problems with potential thread-pool deadlocks calling .Result in a synchronous method.
Interesting, if you try to paste my code without code bloc or formatting, it strips away words. I will look at the Couchbase DI extension and let you know.