Skip to content

Commit

Permalink
updates (#325)
Browse files Browse the repository at this point in the history
* .NET core / framework compat (#310)

* .NET core / framework compat

DOC-11619

* Update supported.adoc

* Per NCBC-3511, update .NET SDK support matrix for LTS and currently-supported SDKs.

Per NCBC-3552, mention that Capella certificate must be installed locally for .NET Framework clients.

* Update "Managing Connections" to mention .NET Framework users must install the Capella certificate locally.

* https://versionsof.net/ link

* Awaiting 23.4.14

* table format / comments

* Get it right this time <sigh>

---------

Co-authored-by: Richard Ponton <[email protected]>

* Ubuntu 22.04

* Delete modules/howtos/pages/durability-error-handling-from-the-sdk.adoc

Ghost page removal

* typo fix

DOC-11739

* Dotnet 3.4.14 GA Release notes (#313)

* Dotnet 3.4.14 GA Release notes

* Gardening started but unfinished

---------

Co-authored-by: Richard Smedley <[email protected]>

* Remove protostellar ticket references (#315)

* Remove protostellar ticket references

* Gardening

---------

Co-authored-by: Richard Smedley <[email protected]>

* Release notes for CouchbaseNetClient 3.4.15 (#316)

* Release notes for CouchbaseNetClient 3.4.15

* Gardening

---------

Co-authored-by: Richard Smedley <[email protected]>

* Remove NCBC-3635 from 3.4.15

* Gardening2 (#319)

* NCBC-3653: Document that IGetResult.Dispose should be called

Motivation
----------
The documentation should explain why Dispose should be called, which
operations are effected and the example code should also do this.

* Gardening

* gardening part duex

---------

Co-authored-by: Richard Smedley <[email protected]>

* NCBC-3440: improve ClusterOptions documentation (#320)

* NCBC-3440: improve ClusterOptions documentation

* ventilated prose

---------

Co-authored-by: Richard Smedley <[email protected]>

* tweaks

---------

Co-authored-by: Richard Ponton <[email protected]>
Co-authored-by: Jeffry Morris <[email protected]>
  • Loading branch information
3 people authored Mar 6, 2024
1 parent a8cfb8e commit 04832a7
Show file tree
Hide file tree
Showing 18 changed files with 139 additions and 51 deletions.
4 changes: 2 additions & 2 deletions modules/devguide/examples/dotnet/Cas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public override async Task ExecuteAsync()
await Task.WhenAll(tasksWithoutCas).ConfigureAwait(false);

// Check if the actual result is 1000 as expected
var result = await Bucket.DefaultCollection().GetAsync(key).ConfigureAwait(false);
using var result = await Bucket.DefaultCollection().GetAsync(key).ConfigureAwait(false);
Console.WriteLine("Expected number = 1000, actual number = " + result.ContentAs<Data>().Number);

// Set the initial number value back to 0
Expand All @@ -39,7 +39,7 @@ public override async Task ExecuteAsync()
await Task.WhenAll(tasksWithCas).ConfigureAwait(false);

// Check if the actual result is 1000 as expected
var result2 = await Bucket.DefaultCollection().GetAsync(key).ConfigureAwait(false);
using var result2 = await Bucket.DefaultCollection().GetAsync(key).ConfigureAwait(false);
Console.WriteLine("Expected number = 1000, actual number = " + result2.ContentAs<Data>().Number);
}

Expand Down
16 changes: 11 additions & 5 deletions modules/devguide/examples/dotnet/Cloud/Cloud.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
using System;
// #tag::using[]
using System.Threading.Tasks;
using Couchbase;

namespace Couchbase.Net.DevGuide.Cloud;
// #end::using[]

await new CloudExample().Main();
public class Progam
{
public static async Task Main(string[] args)
{
await new CloudExample().Main();
}
}

class CloudExample
{
Expand Down Expand Up @@ -44,7 +50,7 @@ public async Task Main()
// #tag::upsert-get[]
// Upsert Document
var upsertResult = await collection.UpsertAsync("my-document-key", new { Name = "Ted", Age = 31 });
var getResult = await collection.GetAsync("my-document-key");
using var getResult = await collection.GetAsync("my-document-key");

Console.WriteLine(getResult.ContentAs<dynamic>());
// #end::upsert-get[]
Expand All @@ -60,4 +66,4 @@ public async Task Main()
}
// end::n1ql-query[]
}
}
}
2 changes: 1 addition & 1 deletion modules/devguide/examples/dotnet/CloudConnect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static async Task Main(string[] args)
});

// Load the Document and print it
var getResult = await collection.GetAsync("king_arthur");
using var getResult = await collection.GetAsync("king_arthur");
Console.WriteLine(getResult.ContentAs<dynamic>());

// Perform a N1QL Query
Expand Down
2 changes: 1 addition & 1 deletion modules/devguide/examples/dotnet/CouchbaseCloud.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private static void Main2(string[] args)

private async Task RunTest()
{
var getResult = await collection.GetAsync("airline_5209").ConfigureAwait(false);
using var getResult = await collection.GetAsync("airline_5209").ConfigureAwait(false);
var docContent = getResult.ContentAs<dynamic>();
Console.WriteLine($"The airline is {docContent.name}.");

Expand Down
4 changes: 2 additions & 2 deletions modules/devguide/examples/dotnet/DevGuide.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp5.0</TargetFramework>
<TargetFramework>.net6</TargetFramework>
<RootNamespace>Couchbase.Net.DevGuide</RootNamespace>
<!-- modify Program.cs to choose which endpoint(s) to run -->
<StartupObject>Couchbase.Net.DevGuide.Program</StartupObject>
Expand All @@ -11,7 +11,7 @@
<Compile Remove="FieldEncryptionRsa.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CouchbaseNetClient" Version="3.1.3" />
<PackageReference Include="CouchbaseNetClient" Version="3.4.15" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.3" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions modules/devguide/examples/dotnet/Retrieve.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override async Task ExecuteAsync()
// Get non-existent document.
// Note that it's enough to check the Status property,
// We're only checking all three to show they exist.
await collection.GetAsync(key).ConfigureAwait(false);
using var result = await collection.GetAsync(key).ConfigureAwait(false);
}
catch (DocumentNotFoundException)
{
Expand All @@ -36,14 +36,14 @@ public override async Task ExecuteAsync()
await collection.UpsertAsync(key, "Hello Couchbase!").ConfigureAwait(false);

// Get a string value
var nonDocResult = await collection.GetAsync(key).ConfigureAwait(false);
using var nonDocResult = await collection.GetAsync(key).ConfigureAwait(false);
Console.WriteLine("Found: " + nonDocResult.ContentAs<string>());

// Prepare a JSON document value
await collection.UpsertAsync(key, data).ConfigureAwait(false);

// Get a JSON document string value
var docResult = await collection.GetAsync(key).ConfigureAwait(false);
using var docResult = await collection.GetAsync(key).ConfigureAwait(false);
Console.WriteLine("Found: " + docResult.ContentAs<Data>());
}

Expand Down
2 changes: 1 addition & 1 deletion modules/devguide/examples/dotnet/SyncExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task PrintDocumentAsync(string id)
Console.WriteLine("Before awaiting GetDocumentAsync on thread {0}.",
Thread.CurrentThread.ManagedThreadId);

var doc = await Bucket.DefaultCollection().GetAsync(id).ConfigureAwait(false);
using var doc = await Bucket.DefaultCollection().GetAsync(id).ConfigureAwait(false);

Console.WriteLine("After awaiting GetDocumentAsync on thread {0}.",
Thread.CurrentThread.ManagedThreadId);
Expand Down
2 changes: 1 addition & 1 deletion modules/devguide/examples/dotnet/Update.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public override async Task ExecuteAsync()


// Check that the data was updated
var newDocument = await collection.GetAsync(key).ConfigureAwait(false);
using var newDocument = await collection.GetAsync(key).ConfigureAwait(false);
Console.WriteLine("Got: " + newDocument.ContentAs<Data>());
}

Expand Down
4 changes: 2 additions & 2 deletions modules/howtos/examples/EncryptingUsingSdk.csx
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ public class EncryptingUsingSdk
.ConfigureAwait(false);

// tag::encrypting_using_sdk_4[]
var getResult1 = await collection.GetAsync(id, options => options.Transcoder(encryptedTranscoder))
using var getResult1 = await collection.GetAsync(id, options => options.Transcoder(encryptedTranscoder))
.ConfigureAwait(false);

var encrypted = getResult1.ContentAs<JObject>();
Console.WriteLine(encrypted);
// end::encrypting_using_sdk_4[]

// tag::encrypting_using_sdk_5[]
var getResult2 = await collection.GetAsync(id, options => options.Transcoder(encryptedTranscoder))
using var getResult2 = await collection.GetAsync(id, options => options.Transcoder(encryptedTranscoder))
.ConfigureAwait(false);

var readItBack = getResult2.ContentAs<Employee>();
Expand Down
8 changes: 4 additions & 4 deletions modules/howtos/examples/ErrorHandling.csx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public class ErrorHandling
try {
// tag::getfetch[]
// This will raise a `CouchbaseException` and propagate it
var result = await collection.GetAsync("my-document-id");
using var result1 = await collection.GetAsync("my-document-id");

// Rethrow with a custom exception type
try {
await collection.GetAsync("my-document-id");
using var result2 = await collection.GetAsync("my-document-id");
} catch (CouchbaseException ex) {
throw new Exception("Couchbase lookup failed", ex);
}
Expand All @@ -61,7 +61,7 @@ public class ErrorHandling
Console.WriteLine("[getcatch]");
// tag::getcatch[]
try {
await collection.GetAsync("my-document-id");
using var result = await collection.GetAsync("my-document-id");
} catch (DocumentNotFoundException) {
await collection.InsertAsync("my-document-id", new {my ="value"});
} catch (CouchbaseException ex) {
Expand Down Expand Up @@ -100,7 +100,7 @@ public class ErrorHandling
Console.WriteLine("[customgrequest]");
IRetryStrategy myCustomStrategy = null;
// tag::customreq[]
await collection.GetAsync("docid", new GetOptions().RetryStrategy(myCustomStrategy));
using var result = await collection.GetAsync("docid", new GetOptions().RetryStrategy(myCustomStrategy));
// end::customreq[]
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/howtos/examples/KvOperations.csx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public class KvOperations
// tag::get[]
var previousResult = await collection.UpsertAsync("string-key", "string value");

var result = await collection.GetAsync("string-key");
using var result = await collection.GetAsync("string-key");
var content = result.ContentAs<String>();
// end::get[]
}
Expand Down
4 changes: 2 additions & 2 deletions modules/howtos/examples/SubDocument.csx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ await _collection.UpsertAsync("customer123", document);
{
Console.WriteLine("get:");
// #tag::get[]
var result = await _collection.LookupInAsync("customer123", specs =>
using var result = await _collection.LookupInAsync("customer123", specs =>
specs.Get("addresses.delivery.country")
);

Expand Down Expand Up @@ -219,7 +219,7 @@ await Concurrent();
async Task CasAsync() {
Console.WriteLine("cas:");
// #tag::cas[]
var player = await _collection.GetAsync("player432");
using var player = await _collection.GetAsync("player432");
ulong decrement = 150;
await _collection.MutateInAsync("player432",
specs => specs.Decrement("gold", decrement),
Expand Down
12 changes: 6 additions & 6 deletions modules/howtos/examples/Transcoding.csx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class Transcoding
// #end::raw-json-encode[]

// #tag::raw-json-decode[]
var rawJsonDecodeResult =
using var rawJsonDecodeResult =
await collection.GetAsync("john-smith", options => options.Transcoder(new RawJsonTranscoder()));

var returnedJson = rawJsonDecodeResult.ContentAs<byte[]>();
Expand All @@ -58,7 +58,7 @@ public class Transcoding
});


var stringResult = await collection.GetAsync(docId, options => options.Transcoder(new RawStringTranscoder()));
using var stringResult = await collection.GetAsync(docId, options => options.Transcoder(new RawStringTranscoder()));

var returnedString = stringResult.ContentAs<string>();
// #end::string[]
Expand All @@ -70,7 +70,7 @@ public class Transcoding

await collection.UpsertAsync(docId, strBytes, options => options.Transcoder(new RawBinaryTranscoder()));

var binaryResult = await collection.GetAsync(docId, options => options.Transcoder(new RawBinaryTranscoder()));
using var binaryResult = await collection.GetAsync(docId, options => options.Transcoder(new RawBinaryTranscoder()));

var returnedBinary = binaryResult.ContentAs<byte[]>();
// #end::binary[]
Expand All @@ -84,7 +84,7 @@ public class Transcoding

await collection.UpsertAsync(docId, bytes, options => options.Transcoder(new RawBinaryTranscoder()));

var binaryMemoryResult = await collection.GetAsync(docId, options => options.Transcoder(new RawBinaryTranscoder()));
using var binaryMemoryResult = await collection.GetAsync(docId, options => options.Transcoder(new RawBinaryTranscoder()));

// Be sure to dispose of the IMemoryOwner<byte> when done, typically via a using statement
using var binary = binaryMemoryResult.ContentAs<IMemoryOwner<byte>>();
Expand All @@ -106,7 +106,7 @@ public class Transcoding

// #tag::custom-decode[]

var customDecodeResult = await collection.GetAsync("john-smith", options => options.Transcoder(transcoder));
using var customDecodeResult = await collection.GetAsync("john-smith", options => options.Transcoder(transcoder));
var returnedUser = customDecodeResult.ContentAs<User>();
// #end::custom-decode[]

Expand Down Expand Up @@ -137,7 +137,7 @@ public class Transcoding

// #tag::msgpack-decode[]

var msgpackResult = await collection.GetAsync("john-smith", options => options.Transcoder(msgpackTranscoder));
using var msgpackResult = await collection.GetAsync("john-smith", options => options.Transcoder(msgpackTranscoder));
var msgpackReturnedUser = msgpackResult.ContentAs<User2>();
// #end::msgpack-decode[]
}
Expand Down
4 changes: 2 additions & 2 deletions modules/howtos/examples/UserManagementExample.csx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class UserManagementExample
Console.WriteLine("Primary index already exists!");
}

var returnedAirline10doc = await collection.GetAsync("airline_10");
using var returnedAirline10doc = await collection.GetAsync("airline_10");

await collection.UpsertAsync(
"airline_11", new {
Expand All @@ -112,7 +112,7 @@ public class UserManagementExample
}
);

var returnedAirline11Doc = await collection.GetAsync("airline_11");
using var returnedAirline11Doc = await collection.GetAsync("airline_11");
Console.WriteLine($"get -> { returnedAirline11Doc.ContentAs<dynamic>() }");

var result = await userCluster.QueryAsync<dynamic>(
Expand Down
1 change: 0 additions & 1 deletion modules/howtos/pages/managing-connections.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ NOTE: Capella's root certificate is *not* signed by a well known CA (Certificate
However, as the certificate is bundled with the SDK when using .NET 6.0 or later, it is trusted by default.
.NET Framework clients will have to add it to the Windows certificate store.


=== Couchbase Server

As of SDK 3.4, if you connect to a Couchbase Server cluster with a root certificate issued by a trusted CA (Certificate Authority), you no longer need to configure this in the `ClusterOptions`.
Expand Down
9 changes: 2 additions & 7 deletions modules/project-docs/pages/compatibility.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,12 @@ include::hello-world:partial$supported.adoc[]
| *✔*
| *✔*

|===



////
// To add after 3.4.14 release:
| .NET 8.0 (Long-Term Support)
| *✖*
| *✔* From 3.4.14
| *✔*
////
|===


// TODO - any outstanding improvements touched upon in https://github.com/couchbase/docs-sdk-dotnet/pull/310

Expand Down
Loading

0 comments on commit 04832a7

Please sign in to comment.