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
@@ -51,24 +51,24 @@ For Azure App Service, upgrades to the guest OS are currently not supported. For
51
51
Note that the installer for .NET 4.6.1 may require more temporary storage during the bootstrapping process on Azure cloud services than the installer for .NET 4.6. To ensure a successful installation, you need to increase temporary storage for your Azure cloud service in your ServiceDefinition.csdef file in the LocalResources section and the environment settings of your startup task, as shown in the following sample:
@@ -78,26 +78,24 @@ Note that the installer for .NET 4.6.1 may require more temporary storage during
78
78
The following sample code uses the familiar programming experience with .NET System.Transactions. The TransactionScope class establishes an ambient transaction in .NET. (An "ambient transaction" is one that lives in the current thread.) All connections opened within the TransactionScope participate in the transaction. If different databases participate, the transaction is automatically elevated to a distributed transaction. The outcome of the transaction is controlled by setting the scope to complete to indicate a commit.
79
79
80
80
```csharp
81
-
using (varscope=newTransactionScope())
81
+
using (varscope=newTransactionScope())
82
+
{
83
+
using (varconn1=newSqlConnection(connStrDb1))
82
84
{
83
-
using (varconn1=newSqlConnection(connStrDb1))
84
-
{
85
-
conn1.Open();
86
-
SqlCommandcmd1=conn1.CreateCommand();
87
-
cmd1.CommandText=string.Format("insert into T1 values(1)");
88
-
cmd1.ExecuteNonQuery();
89
-
}
90
-
91
-
using (varconn2=newSqlConnection(connStrDb2))
92
-
{
93
-
conn2.Open();
94
-
varcmd2=conn2.CreateCommand();
95
-
cmd2.CommandText=string.Format("insert into T2 values(2)");
96
-
cmd2.ExecuteNonQuery();
97
-
}
98
-
99
-
scope.Complete();
85
+
conn1.Open();
86
+
SqlCommandcmd1=conn1.CreateCommand();
87
+
cmd1.CommandText=string.Format("insert into T1 values(1)");
88
+
cmd1.ExecuteNonQuery();
100
89
}
90
+
using (varconn2=newSqlConnection(connStrDb2))
91
+
{
92
+
conn2.Open();
93
+
varcmd2=conn2.CreateCommand();
94
+
cmd2.CommandText=string.Format("insert into T2 values(2)");
95
+
cmd2.ExecuteNonQuery();
96
+
}
97
+
scope.Complete();
98
+
}
101
99
```
102
100
103
101
### Sharded database applications
@@ -106,24 +104,22 @@ Elastic database transactions for SQL Database and Managed Instance also support
106
104
The following code sample illustrates this approach. It assumes that a variable called shardmap is used to represent a shard map from the elastic database client library:
107
105
108
106
```csharp
109
-
using (varscope=newTransactionScope())
107
+
using (varscope=newTransactionScope())
108
+
{
109
+
using (varconn1=shardmap.OpenConnectionForKey(tenantId1, credentialsStr))
110
110
{
111
-
using (varconn1=shardmap.OpenConnectionForKey(tenantId1, credentialsStr))
112
-
{
113
-
SqlCommandcmd1=conn1.CreateCommand();
114
-
cmd1.CommandText=string.Format("insert into T1 values(1)");
115
-
cmd1.ExecuteNonQuery();
116
-
}
117
-
118
-
using (varconn2=shardmap.OpenConnectionForKey(tenantId2, credentialsStr))
119
-
{
120
-
varcmd2=conn2.CreateCommand();
121
-
cmd2.CommandText=string.Format("insert into T1 values(2)");
122
-
cmd2.ExecuteNonQuery();
123
-
}
124
-
125
-
scope.Complete();
111
+
SqlCommandcmd1=conn1.CreateCommand();
112
+
cmd1.CommandText=string.Format("insert into T1 values(1)");
113
+
cmd1.ExecuteNonQuery();
126
114
}
115
+
using (varconn2=shardmap.OpenConnectionForKey(tenantId2, credentialsStr))
116
+
{
117
+
varcmd2=conn2.CreateCommand();
118
+
cmd2.CommandText=string.Format("insert into T1 values(2)");
119
+
cmd2.ExecuteNonQuery();
120
+
}
121
+
scope.Complete();
122
+
}
127
123
```
128
124
129
125
## Transact-SQL development experience
@@ -133,35 +129,32 @@ A server-side distributed transactions using Transact-SQL are available only for
133
129
The following sample Transact-SQL code uses [BEGIN DISTRIBUTED TRANSACTION](/sql/t-sql/language-elements/begin-distributed-transaction-transact-sql) to start distributed transaction.
134
130
135
131
```Transact-SQL
136
-
137
-
-- Configure the Linked Server
138
-
-- Add one Azure SQL Managed Instance as Linked Server
0 commit comments