couchbase - Connecting to a Bucket in couchbase - couchbase tutorial - couchbase lite
Configuring the connection programmatically
var config = new ClientConfiguration
{
Servers = new List<Uri> {
new Uri("http://localhost:8091/pools")
},
BucketConfigs = new Dictionary<string, BucketConfiguration>
{
{ "default", new BucketConfiguration
{
BucketName = "default",
UseSsl = false,
Password = "",
DefaultOperationLifespan = 2000,
PoolConfiguration = new PoolConfiguration
{
MaxSize = 10,
MinSize = 5,
SendTimeout = 12000
}
}}
}
};
var cluster = new Cluster(config);
var bucket = cluster.OpenBucket();
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy Couchbase tutorial team
Configuring the connection in web.config / app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="couchbaseClients">
<section name="couchbase" type="Couchbase.Configuration.Client.Providers.CouchbaseClientSection, Couchbase.NetClient" />
</sectionGroup>
</configSections>
<couchbaseClients>
<couchbase useSsl="false">
<servers>
<add uri="http://localhost:8091/pools"></add>
</servers>
<buckets>
<add name="default" useSsl="false" password="">
<connectionPool name="custom" maxSize="10" minSize="5" sendTimeout="12000" />
</add>
</buckets>
</couchbase>
</couchbaseClients>
</configuration>
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy Couchbase tutorial team
Using the config section:
var cluster = new Cluster("couchbaseClients/couchbase");
var bucket = cluster.OpenBucket();