You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/hello-world/pages/start-using-sdk.adoc
+97-47Lines changed: 97 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,26 +12,70 @@ It offers an asynchronous API based on the link:https://docs.microsoft.com/en-us
12
12
The Couchbase .NET client allows applications to connect to Couchbase Server using any Common Language Runtime (CLR) language, including C#, F#, and VB.NET.
13
13
The SDK is written in C#, and some of its idiomatic patterns reflect that choice.
14
14
15
+
16
+
== Hello Couchbase
17
+
18
+
On this page we show you how to quickly get up and running -- installing the Couchbase .NET SDK, and trying out the C# _Hello World_ code example against Couchbase Capella, or against a local Couchbase cluster.
19
+
20
+
We will go through the code sample step by step, but for those in a hurry to see it, here it is:
21
+
22
+
[{tabs}]
23
+
====
24
+
Couchbase Capella Sample::
25
+
+
26
+
--
27
+
If you are connecting to https://docs.couchbase.com/cloud/index.html[Couchbase Capella], be sure to get the correct endpoint as well as user, password, and `couchbasecloudbucket` -- and see the <<cloud-connections, Cloud section>>, below.
28
+
29
+
[source,csharp]
30
+
----
31
+
include::devguide:example$dotnet/Cloud.cs[]
32
+
----
33
+
--
34
+
35
+
Local Couchbase Server::
36
+
+
37
+
--
38
+
[source.try-it,csharp]
39
+
----
40
+
include::example$StartUsing.cs[tags=**]
41
+
----
42
+
--
43
+
====
44
+
45
+
15
46
== Installing the SDK
16
47
48
+
=== Requirements
49
+
17
50
include::partial$supported.adoc[]
18
51
See the xref:project-docs:compatibility.adoc#dotnet-compatibility[Compatibility] section for more details.
19
52
20
-
The library is distributed in a number of ways:
21
53
22
-
|===
23
-
|NuGet |NuGet package host at https://www.nuget.org/packages/CouchbaseNetClient/[nuget.org] (_recommended_)
24
-
|Zip |Zip files for each release are linked from the Release Notes xref:project-docs:sdk-release-notes.adoc[here].
25
-
|Build from Source |Build the library from https://github.com/couchbase/couchbase-net-client/[source available on GitHub] (not officially supported)
26
-
|===
54
+
=== Quick Install
27
55
56
+
The quickest way to get up and running is with NuGet, from the Package Manager Console, within your project:
. In the console, enter the package installation command:
61
+
** To install the latest version:
62
+
63
+
[source,console]
64
+
----
65
+
Install-Package CouchbaseNetClient
66
+
----
67
+
68
+
All other installation methods can be found in our xref:project-docs:sdk-full-installation[full installation guide].
30
69
31
-
Start a new console project (in Visual Studio or VS Code, etc). +
70
+
71
+
== Step by Step
72
+
73
+
Start a new console project (in Visual Studio or VS Code, etc).
32
74
Go to our xref:platform-help.adoc[Platform Introduction] if you don't already have an editor or IDE setup for working in .NET -- e.g. you are evaluating the .NET SDK, but .NET is not your normal platform.
33
75
34
-
Install the latest 3.2 https://www.nuget.org/packages/CouchbaseNetClient/[CouchbaseNetClient^] NuGet package.
76
+
=== Prerequisites
77
+
78
+
Install the latest 3.3 https://www.nuget.org/packages/CouchbaseNetClient/[CouchbaseNetClient^] NuGet package -- see <<quick-install,above>>.
35
79
36
80
The following code samples assume:
37
81
@@ -45,34 +89,50 @@ Firstly, you will need to have a few `using` statements at the top of *Program.c
Substitute whatever bucket name you want for _bucket-name_ in the above example.
65
-
66
-
The 3.2 SDK is ready for the introduction of xref:concept-docs:collections.adoc[Collections] in the xref:{version-server}@server:introduction:whats-new.adoc#whats-new-server-700[7.0 release] of the Couchbase Data Platform.
67
-
The latest release, Couchbase Server 7.0, brings Collections, allowing Documents to be grouped by purpose or theme, according to specified _Scope_.
128
+
Collections allowi Documents to be grouped by purpose or theme, according to specified _Scope_.
129
+
Our Travel Sample bucket has separate scopes for inventory (flights, etc.), and for tenants (different travel agents).
NOTE: This feature was previously avaiable as a _developer preview_ from Couchbase Server 6.6. _When connecting to a 6.6 cluster or earlier_, we must use the `DefaultCollection`, which covers the whole Bucket.
75
-
76
136
To get you started the following code creates a new document in a custom scope and collection and then fetches it again, printing the result.
You can learn more about N1QL queries on the xref:howtos:n1ql-queries-with-sdk.adoc[Query page].
96
156
97
-
== Full Example
98
157
99
-
If you want to copy and paste to run the full example, here it is:
100
158
101
-
[{tabs}]
102
-
====
103
-
Local Couchbase Server::
104
-
+
105
-
--
106
-
[source.try-it,csharp]
107
-
----
108
-
include::example$StartUsing.cs[tags=**]
109
-
----
110
-
--
111
159
112
-
Couchbase Capella Sample::
113
-
+
114
-
--
115
-
If you are connecting to https://docs.couchbase.com/cloud/index.html[Couchbase Capella], be sure to get the correct endpoint as well as user, password, and `couchbasecloudbucket` -- and see the <<cloud-connections, Cloud section>>, below.
160
+
== Next Steps
116
161
117
-
[source,csharp]
118
-
----
119
-
include::devguide:example$dotnet/Cloud.cs[]
120
-
----
121
-
--
122
-
====
162
+
Now you're up and running, try one of the following:
123
163
164
+
* Our xref:hello-world:sample-application.adoc[Travel Sample Application] demonstrates all the basics you need to know;
165
+
* Explore xref:howtos:kv-operations.adoc[Key Value Operations] against a document database;
166
+
* Or xref:howtos:n1ql-queries-with-sdk.adoc[Query] with our SQL-based N1QL language;
167
+
// * Try longer-running queries with our xref:howtos:analytics-using-sdk.adoc[Analytics Service];
168
+
// * A xref:howtos:full-text-searching-with-sdk.adoc[Full Text Search];
169
+
* Or read up on xref:concept-docs:data-services.adoc[which service fits your use case].
124
170
125
-
== Cloud Connections
126
171
127
-
For developing on https://docs.couchbase.com/cloud/index.html[Couchbase Capella], if you are not working from the same _Availability Zone_, refer to the follorwing:
172
+
=== Additional Resources
128
173
129
-
* Notes on xref:ref:client-settings.adoc#constrained-network-environments[Constrained Network Environments],
* If you have a consumer-grade router which has problems with DNS-SRV records review our xref:howtos:troubleshooting-cloud-connections.adoc#troubleshooting-host-not-found[Troubleshooting Guide].
132
174
175
+
The https://docs.couchbase.com/sdk-api/couchbase-net-client/api/index.html[API reference] is generated for each release.
176
+
Older API references are linked from their respective sections in the xref:project-docs:sdk-release-notes.adoc[Release Notes].
133
177
178
+
xref:project-docs:migrating-sdk-code-to-3.n.adoc[The Migrating from SDK2 to 3 page] highlights the main differences to be aware of when migrating your code from our earlier 2.x .NET SDK.
134
179
135
-
== Additional Resources
180
+
// Couchbase welcomes community contributions to the Python SDK.
181
+
// The Python SDK source code is available on https://github.com/couchbase/couchbase-python-client[GitHub].
136
182
137
-
The https://docs.couchbase.com/sdk-api/couchbase-net-client/api/index.html[API reference] is generated for each release.
138
-
Older API references are linked from their respective sections in the xref:project-docs:sdk-release-notes.adoc[Release Notes].
183
+
=== Troubleshooting
139
184
140
-
xref:project-docs:migrating-sdk-code-to-3.n.adoc[The Migrating from SDK2 to 3 page] highlights the main differences to be aware of when migrating your code.
185
+
* Couchbase Server is designed to work in the same WAN or availability zone as the client application.
186
+
If you're running the SDK on your laptop against a Capella cluster, see further information on:
187
+
** Notes on xref:ref:client-settings.adoc#constrained-network-environments[Constrained Network Environments].
** If you have a consumer-grade router which has problems with DNS-SRV records review our xref:howtos:troubleshooting-cloud-connections.adoc#troubleshooting-host-not-found[Troubleshooting Guide].
190
+
* Our https://forums.couchbase.com/c/net-sdk/6[community forum] is a great source of help.
0 commit comments