We’re building an ASP.NET Core web application. Our database is Couchbase Server 5.0.
There are a few nuget packages available. We’re evaluating “Linq2Couchbase” and “Couchbase.Extensions.Dependencyinjection”.
In the “Linq2Couchbase” examples, the dependency injection is done with the ClusterHelper and all Linq queries are run in the ClusterHelper bucket context. Example:
var context = new BucketContext(ClusterHelper.GetBucket("travel-sample")); var query = (from a in context.Query<AirLine>() where a.Country == "United Kingdom" select a). Take(10);
In “Couchbase.Extensions.DependencyInjection” (or CEDI) you’re injecting a bucket where you are supposed to use string queries. Example:
var bucket = _bucketProvider.GetBucket(); var result = await bucket.QueryAsync<Airline>( "SELECT Extent.* FROM `travel-sample` AS Extent WHERE type = 'airline' ORDER BY name");
Are these modules/extensions supposed to be used together? If so - how? What is the recommended approach?