Skip to content

Commit f6e35a2

Browse files
committed
updated readme
1 parent 0483330 commit f6e35a2

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,19 @@ Guidance on onboarding samples to docs.microsoft.com/samples: https://review.doc
2727
Taxonomies for products and languages: https://review.docs.microsoft.com/new-hope/information-architecture/metadata/taxonomies?branch=master
2828
-->
2929

30-
Thanks to native JSON support, creating a REST API with Azure SQL and .NET Core is really a matter of a few lines of code. Take a look at `app.py` to easy it is!
30+
Thanks to native JSON support, creating a REST API with Azure SQL and .NET Core is really a matter of a few lines of code:
31+
32+
```csharp
33+
var qr = await conn.ExecuteScalarAsync<string>(
34+
sql: procedure,
35+
param: parameters,
36+
commandType: CommandType.StoredProcedure
37+
);
38+
39+
var result = JsonDocument.Parse(qr);
40+
```
3141

32-
Wondering what's the magic behind? The sample uses the well known [Flask](https://flask.palletsprojects.com/en/1.1.x/) micro-framework and the [flask-restful](https://flask-restful.readthedocs.io/en/latest/) package to easily implement REST APIs. Beside that the [native JSON support that Azure SQL provides](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-json-features) does all the heavy lifting so sending data back and forth to the database is as easy as sending a JSON message.
42+
This is possible thanks to [Azure SQL native support to JSON](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-json-features) format and the MicroORM [Dapper](https://medium.com/dapper-net/get-started-with-dapper-net-591592c335aa) that removes all the plumbing code and returns not tables and columns but a fully deserialized object. Object that can be a POCO object or just JSON for maximum flexibilty.
3343

3444
## Install Sample Database
3545

@@ -65,7 +75,7 @@ $Env:ConnectionStrings__DefaultConnection="<your-connection-string>"
6575

6676
Your connection string is something like:
6777

68-
```
78+
```text
6979
DRIVER={ODBC Driver 17 for SQL Server};SERVER=<your-server-name>.database.windows.net;DATABASE=<your-database-name>;UID=DotNetWebApp;PWD=a987REALLY#$%TRONGpa44w0rd
7080
```
7181

@@ -116,8 +126,7 @@ Check out more samples to test all implemented verbs here:
116126

117127
Now that your REST API solution is ready, it's time to deploy it on Azure so that anyone can take advantage of it. A detailed article on how you can that that is here:
118128

119-
- [Deploying Python web apps to Azure App Services](https://medium.com/@GeekTrainer/deploying-python-web-apps-to-azure-app-services-413cc16d4d68)
120-
- [Quickstart: Create a Python app in Azure App Service on Linux](https://docs.microsoft.com/en-us/azure/app-service/containers/quickstart-python?tabs=bash)
129+
- [Create an ASP.NET Core app in App Service on Linux](https://docs.microsoft.com/en-us/azure/app-service/containers/quickstart-dotnetcore)
121130

122131
The only thing you have do in addition to what explained in the above articles is to add the connection string to the Azure Web App configuration. Using AZ CLI, for example:
123132

0 commit comments

Comments
 (0)