Skip to content

Commit 5365da1

Browse files
authored
Create README.md
1 parent 8c77d78 commit 5365da1

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

  • samples/tutorials/c#/Windows/SqlMIResilientCloudApp
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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 is made 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 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 to the project (see here: https://docs.microsoft.com/en-us/visualstudio/ide/how-to-add-app-config-file?view=vs-2019)
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+
CREATE DATABASE failoverDB;
19+
USE failoverDB;
20+
CREATE TABLE timetable (datestamp datetime);
21+
INSERT INTO timetable (datestamp) VALUES (CURRENT_TIMESTAMP);
22+
SELECT * FROM timetable;
23+
24+
# Demo
25+
26+
- 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.
27+
- As the application is running, you can use the SELECT * FROM timetable; to see the queries being inserted into the table.
28+
- Use instructions in this article http://aka.ms/mifailover-techblog to execute a PowerShell that will failover a Managed Instance.
29+
- Watch the application resiliency (with ResilientQuery variable true and false) while initiating failover on SQL MI

0 commit comments

Comments
 (0)