Skip to content

Commit 8bf59ac

Browse files
Merge pull request #884 from danimir/patch-1
Create README.md
2 parents 8c77d78 + af1bf35 commit 8bf59ac

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

  • samples/tutorials/c#/Windows/SqlMIResilientCloudApp
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
![](../media/solutions-microsoft-logo-small.png)
2+
3+
# About
4+
This source code is an example of buildling cloud-ready apps that are resilient to transient errors and failovers in the cloud. In particular, the example was made in C# with Azure SQL Managed Instance, but it can be applied to other SQL servers as well.
5+
6+
The accompanying article to this source code is the following: here: http://aka.ms/mifailover-techblog
7+
8+
# How to build
9+
10+
- Create Console app project in Visual Studio
11+
- Copy-paste the program file
12+
- Use App.config to enter your SQL MI connection details. In Visual Studio, you will also need to [add your config file](https://docs.microsoft.com/en-us/visualstudio/ide/how-to-add-app-config-file) to the project.
13+
14+
# Database side configuration
15+
16+
On SQL MI (e.g. using SSMS) you will need to create a failoverDB. Use the follwing t-sql script:
17+
18+
```t-sql
19+
CREATE DATABASE failoverDB;
20+
USE failoverDB;
21+
CREATE TABLE timetable (datestamp datetime);
22+
INSERT INTO timetable (datestamp) VALUES (CURRENT_TIMESTAMP);
23+
SELECT * FROM timetable;
24+
```
25+
26+
# Demo
27+
28+
- Use boolean variable "ResilientQuery" to set the app resiliency. False would run the app with no resiliency which will cause the app to be terminanted on SQL MI failover. True would run the resilient retry logic, the application will continue running after SQL MI failover.
29+
- As the application is running, you can use the SELECT * FROM timetable; to see the queries being inserted into the table.
30+
- Use instructions in this article http://aka.ms/mifailover-techblog to execute a PowerShell that will failover a Managed Instance.
31+
- Watch the application resiliency (with ResilientQuery variable true and false) while initiating failover on SQL MI

0 commit comments

Comments
 (0)