Linq2Couchbase Question

I am quite new to Couchbase. Trying to query it via Linq2Couchbase and running into issues.

here is what my code looks like

       var prefBucket = ClusterHelper.GetBucket("preferences");
       var db = new BucketContext(prefBucket);
       var query = from b in db.Query<Preference>()
                    select b;

        foreach (Preference p in query)
        {
            results.Add(p);
        }

For some reason the Bucket object in bucketcontext/query is always null.
Not sure what I am missing.

@neelima_godugu

Is the prefBucket local variable null before you pass it to the BucketContext constructor?

@btburnett3 Thanks for the reply.
It is not null. I verified that.

@neelima_godugu

That is very unusual. I’ve checked the code, and I don’t see how it gets to be null other than it being passed into the constructor. The field is marked as read only.

A few other questions:

  1. Are you using a special environment like Mono, or is this in the good old fashioned .Net framework?
  2. Are you using Linq2Couchbase 1.0.2?
  3. Can you provide an example project, maybe in GitHub, that reproduces the problem?

@neelima_godugu -

Are you initializing the Cluster helper?

ClusterHelper.Initialize();

@jmorris
Yes, I didn’t post that code as I am doing it once app wide.

Can you provide an example project illustrating the issue? You can post it to an issue here: https://issues.couchbase.com/projects/LINQ

On the ticket, please include the cluster setup, Couchbase Server version, and SDK version.

Thanks,

Jeff