@@ -37,26 +37,8 @@ versions of the standard command methods
3737buffered in the pipeline and only execute when you call the ` Execute() `
3838method on the pipeline object.
3939
40- <!-- < clients-example pipe_trans_tutorial basic_pipe "C#" >}}
41- < /clients-example >}} -->
42-
43- ``` csharp
44- var pipeline = new Pipeline (db );
45-
46- for (int i = 0 ; i < 5 ; i ++ ) {
47- pipeline .Db .StringSetAsync ($" seat:{i }" , $" #{i }" );
48- }
49- pipeline .Execute ();
50-
51- var resp1 = db .StringGet (" seat:0" );
52- Console .WriteLine (resp1 ); // >>> #0
53-
54- var resp2 = db .StringGet (" seat:3" );
55- Console .WriteLine (resp2 ); // >>> #3
56-
57- var resp3 = db .StringGet (" seat:4" );
58- Console .WriteLine (resp2 ); // >>> #4
59- ```
40+ {{< clients-example pipe_trans_tutorial basic_pipe "C#" >}}
41+ {{< /clients-example >}}
6042
6143## Execute a transaction
6244
@@ -65,27 +47,8 @@ instance of the `Transaction` class, call async command methods
6547on that object, and then call the transaction object's
6648` Execute() ` method to execute it.
6749
68- <!-- < clients-example pipe_trans_tutorial basic_trans "C#" >}}
69- < /clients-example >}}-->
70-
71- ``` csharp
72- var trans = new Transaction (db );
73-
74- trans .Db .StringIncrementAsync (" counter:1" , 1 );
75- trans .Db .StringIncrementAsync (" counter:2" , 2 );
76- trans .Db .StringIncrementAsync (" counter:3" , 3 );
77-
78- trans .Execute ();
79-
80- var resp4 = db .StringGet (" counter:1" );
81- Console .WriteLine (resp4 ); // >>> 1
82-
83- var resp5 = db .StringGet (" counter:2" );
84- Console .WriteLine (resp5 ); // >>> 2
85-
86- var resp6 = db .StringGet (" counter:3" );
87- Console .WriteLine (resp6 ); // >>> 3
88- ```
50+ {{< clients-example pipe_trans_tutorial basic_trans "C#" >}}
51+ {{< /clients-example >}}
8952
9053## Watch keys for changes
9154
@@ -114,25 +77,8 @@ For example, the `KeyNotExists` condition aborts the transaction
11477if a specified key exists or is added by another client while the
11578transaction executes:
11679
117- <!-- < clients-example pipe_trans_tutorial trans_watch "C#" >}}
118- < /clients-example >}} -->
119-
120- ``` csharp
121- var watchedTrans = new Transaction (db );
122-
123- watchedTrans .AddCondition (Condition .KeyNotExists (" customer:39182" ));
124-
125- watchedTrans .Db .HashSetAsync (
126- " customer:39182" ,
127- new HashEntry []{
128- new HashEntry (" name" , " David" ),
129- new HashEntry (" age" , " 27" )
130- }
131- );
132-
133- bool succeeded = watchedTrans .Execute ();
134- Console .WriteLine (succeeded ); // >>> true
135- ```
80+ {{< clients-example pipe_trans_tutorial trans_watch "C#" >}}
81+ {{< /clients-example >}}
13682
13783You can also use a ` When ` condition on certain individual commands to
13884specify that they only execute when a certain condition holds
0 commit comments