.NET SDK questions
Mon, 06/11/2012 - 08:23
Good day!
I want to switch from MySQL to CouchBase and I have been having some problems doing this. After reading all the tutorials, manuals and googling for hours, I still need an answer to the following questions please:
1. How do you programatically declare a new CouchBaseClient instance? I need to connect to different buckets depending on the user which logs on. The Getting Started tutorial only mentions this as possible, but doesn't give any actual way of doing it.
2. How do you create new buckets programatically? I need this to create a new bucket everytime someone registers. Nothing on the internet regarding .NET, only from telnet and through a command line.
Thank you very much!
Hi Tony,
I see that you saw my answer on StackOverflow, but including it here for others who might have the same question:
___
Answers below. A few things to consider... It's relatively expensive to create a client instance. You generally don't want to create a new CouchbaseClient (with bucket affinity) more than once per app domain.
Also keep in mind that buckets aren't really meant to be per-user multi-tenancy. Buckets are somewhat analogous to databases - if you were to use the MySQL for this app, would you create a new database for each user?
You can read more about setting up multiple buckets in config at:
http://www.couchbase.com/wiki/display/couchbase/Couchbase+.NET+Client+Li...
var config = new CouchbaseClientConfiguration(); config.Urls.Add(new Uri("http://localhost:8091/pools/default")); config.Bucket = "default";
var client = new CouchbaseClient(config);
2.
This functionality currently is not part of the .NET Client Library.