简体   繁体   English

如何在app.config中更改默认存储桶

[英]How to change default Bucket in app.config

My App.Config looks like this. 我的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="CBMigration" useSsl="false">
          <connectionPool name="custom" maxSize="10" minSize="5"></connectionPool>
        </add>
      </buckets>
    </couchbase>
  </couchbaseClients>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
  </startup>
</configuration>

In that i given bucket name is "CBMigration" but still the entries are in default bucket only. 在这种情况下,我指定的存储桶名称为“ CBMigration”,但条目仅在默认存储桶中。 And my c# code for initializing cluster is _instance = new Cluster("couchbaseClients/couchbase"); 我用于初始化集群的c#代码是_instance = new Cluster("couchbaseClients/couchbase");

I need to make the bucket as "CBMigration" for the Cluster i initialized using the app.config. 对于使用app.config初始化的集群,我需要将存储桶设置为“ CBMigration”。

Where i am going wrong ? 我要去哪里错了? Please help me... 请帮我...

I think there's a gap in documentation there. 我认为那里的文档存在差距。 The bucket entries in are only used to provide customized defaults for the bucket's configuration. 中的存储桶条目仅用于为存储桶的配置提供自定义的默认值。 That is the use of ssl, connection pool tuning, etc... 那就是使用ssl,连接池调整等。

But having just one bucket config entry like that doesn't actually change the behavior of OpenBucket() : the default bucket used by the client is always "default". 但是只有一个这样的存储桶配置条目实际上并不会改变OpenBucket()的行为:客户端使用的默认存储桶始终为“默认”。

You still have to explicitly open the specific bucket you want, using OpenBucket(BucketName, BucketPassword) ... It's just that once you do that, said bucket will be opened using tuning parameters found in its corresponding section in App.config instead of hardcoded default ones. 您仍然必须使用OpenBucket(BucketName, BucketPassword)显式打开所需的特定存储桶...只是,一旦执行此操作,将使用在App.config的相应部分中找到的调整参数来打开存储桶,而不是硬编码默认的。

Does that make sense? 那有意义吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM