Skip to content

Commit 40481f6

Browse files
osfameronjeffrymorris
authored andcommitted
Move to Cloud.cs
`dotnet-script` isn't happy with SDK 3.3.0 versions of Microsoft.Extensions.Logging.Abstractions 6.0.0 vs 6.0.1 but running with your own .csproj has no problem. In own subdirectory, to get the primary benefit of script, that is, not having to compile *all the examples* just to run one example.
1 parent eb9e0a1 commit 40481f6

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

modules/devguide/examples/dotnet/Cloud.csx renamed to modules/devguide/examples/dotnet/Cloud/Cloud.cs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
// Run this using dotnet-script: https://github.com/filipw/dotnet-script
2-
//
3-
// dotnet script Cloud.csx
4-
//
5-
6-
#r "nuget: CouchbaseNetClient, 3.2.8-pre"
7-
// #r "nuget: System.Text.Json, 6.0.2"
8-
// #r "nuget: Microsoft.Extensions.Logging.Abstractions, 6.0.1"
9-
// #r "nuget: CouchbaseNetClient, 3.3.0"
10-
11-
using System;
1+
using System;
122
// #tag::using[]
133
using System.Threading.Tasks;
144
using Couchbase;
@@ -24,8 +14,12 @@ public async Task Main()
2414
var cluster = await Cluster.ConnectAsync(
2515
// Update these credentials for your Capella instance!
2616
"couchbases://cb.njg8j7mwqnvwjqah.cloud.couchbase.com",
27-
"username",
28-
"Password!123");
17+
new ClusterOptions
18+
{
19+
UserName = "username",
20+
Password = "Password!123",
21+
KvTimeout = TimeSpan.FromSeconds(10)
22+
});
2923
// #end::connect[]
3024

3125
// #tag::bucket[]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<LangVersion>latest</LangVersion>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="CouchbaseNetClient" Version="3.3.0" />
11+
</ItemGroup>
12+
<Target Name="RecordReferencePaths" AfterTargets="AfterResolveReferences">
13+
<WriteLinesToFile File="$(OutputPath)/ReferencePaths.txt" Lines="@(ReferencePath)" />
14+
</Target>
15+
16+
</Project>

modules/hello-world/pages/start-using-sdk.adoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ If you are connecting to https://docs.couchbase.com/cloud/index.html[Couchbase C
2929
3030
[source,csharp]
3131
----
32-
include::devguide:example$dotnet/Cloud.csx[tags=**]
32+
include::devguide:example$dotnet/Cloud/Cloud.cs[tags=**]
3333
----
3434
3535
The Couchbase Capella free trial version comes with the Travel Sample Bucket, and its Query indexes, loaded and ready.
@@ -109,7 +109,7 @@ Capella Connection::
109109
--
110110
[source,csharp]
111111
----
112-
include::devguide:example$dotnet/Cloud.csx[tag=connect,indent=0]
112+
include::devguide:example$dotnet/Cloud/Cloud.cs[tag=connect,indent=0]
113113
----
114114
115115
From 3.3, the .NET SDK includes Capella's standard certificates by default, so you do not need to additional configuration.
@@ -123,11 +123,16 @@ Local Server Connection::
123123
----
124124
include::example$StartUsing.cs[tag=connect,indent=0]
125125
----
126+
127+
If you're developing client code on the same machine as the Couchbase Server, your URI can be _couchbase://localhost_ as here.
128+
129+
WARNING: for Production deployments, you will want to use a secure server,
130+
with `couchbases://`
126131
--
127132
====
128133

129134
Couchbase uses xref:server:learn:security/roles.adoc[Role Based Access Control (RBAC)] to control access to resources.
130-
If you're developing client code on the same machine as the Couchbase Server, your URI can be _couchbase://localhost_.
135+
131136

132137
=== Bucket, Scopes, and Collections
133138

@@ -137,7 +142,7 @@ Open the bucket:
137142
include::example$StartUsing.cs[tag=bucket,indent=0]
138143
----
139144

140-
Collections allowi Documents to be grouped by purpose or theme, according to specified _Scope_.
145+
Collections allow Documents to be grouped by purpose or theme, according to specified _Scope_.
141146
Our Travel Sample bucket has separate scopes for inventory (flights, etc.), and for tenants (different travel agents).
142147

143148
[source,csharp]

0 commit comments

Comments
 (0)