1 static Activity ScenarioTwo()
2 {
3 return new Sequence
4 {
5 Activities =
6 {
7 new WriteLine { Text = " Begin workflow" },
8
9 new TransactionScope
10 {
11 Body = new Sequence
12 {
13 Activities =
14 {
15 new WriteLine { Text = " Begin TransactionScope" },
16
17 new PrintTransactionId(),
18
19 new TransactionScope
20 {
21 Body = new Delay { Duration = TimeSpan.FromSeconds(5) },
22 Timeout = TimeSpan.FromSeconds(2),
23 },
24
25 new WriteLine { Text = " End TransactionScope" },
26 },
27 },
28 Timeout = TimeSpan.FromSeconds(10),
29 },
30
31 new WriteLine { Text = " End workflow" },
32 }
33 };
34 }
这些代码最大的特点是每行使用逗号结尾.