Skip to content

Commit 3a159fa

Browse files
Fix trigger tutorial location
1 parent 863b688 commit 3a159fa

File tree

1 file changed

+47
-40
lines changed

1 file changed

+47
-40
lines changed

README.md

Lines changed: 47 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ Azure SQL bindings for Azure Functions are supported for:
3333
- [.NET functions](#net-functions)
3434
- [Input Binding Tutorial](#input-binding-tutorial)
3535
- [Output Binding Tutorial](#output-binding-tutorial)
36+
- [Trigger Binding Tutorial](#trigger-binding-tutorial)
37+
- [JavaScript functions](#javascript-functions)
38+
- [Input Binding Tutorial](#input-binding-tutorial-1)
39+
- [Output Binding Tutorial](#output-binding-tutorial-1)
40+
- [Python functions](#python-functions)
41+
- [Input Binding Tutorial](#input-binding-tutorial-2)
42+
- [Output Binding Tutorial](#output-binding-tutorial-2)
3643
- [More Samples](#more-samples)
3744
- [Input Binding](#input-binding)
3845
- [Query String](#query-string)
@@ -297,6 +304,46 @@ Note: This tutorial requires that a SQL database is setup as shown in [Create a
297304
- Hit 'F5' to run your code. Click the link to upsert the output array values in your SQL table. Your upserted values should launch in the browser.
298305
- Congratulations! You have successfully created your first SQL output binding! Checkout [Output Binding](#Output-Binding) for more information on how to use it and explore on your own!
299306
307+
#### Trigger Binding Tutorial
308+
309+
Note: This tutorial requires that a SQL database is setup as shown in [Create a SQL Server](#create-a-sql-server), and that you have the 'Employee.cs' file from the [Input Binding Tutorial](#input-binding-tutorial).
310+
311+
- Create a new file with the following content:
312+
313+
```csharp
314+
using System.Collections.Generic;
315+
using Microsoft.Azure.WebJobs;
316+
using Microsoft.Extensions.Logging;
317+
using Microsoft.Azure.WebJobs.Extensions.Sql;
318+
319+
namespace Company.Function
320+
{
321+
public static class EmployeeTrigger
322+
{
323+
[FunctionName("EmployeeTrigger")]
324+
public static void Run(
325+
[SqlTrigger("[dbo].[Employees]", ConnectionStringSetting = "SqlConnectionString")]
326+
IReadOnlyList<SqlChange<Employee>> changes,
327+
ILogger logger)
328+
{
329+
foreach (SqlChange<Employee> change in changes)
330+
{
331+
Employee employee = change.Item;
332+
logger.LogInformation($"Change operation: {change.Operation}");
333+
logger.LogInformation($"EmployeeID: {employee.EmployeeId}, FirstName: {employee.FirstName}, LastName: {employee.LastName}, Company: {employee.Company}, Team: {employee.Team}");
334+
}
335+
}
336+
}
337+
}
338+
```
339+
340+
- *Skip these steps if you have not completed the output binding tutorial.*
341+
- Open your output binding file and modify some of the values. For example, change the value of Team column from 'Functions' to 'Azure SQL'.
342+
- Hit 'F5' to run your code. Click the link of the HTTP trigger from the output binding tutorial.
343+
- Update, insert, or delete rows in your SQL table while the function app is running and observe the function logs.
344+
- You should see the new log messages in the Visual Studio Code terminal containing the values of row-columns after the update operation.
345+
- Congratulations! You have successfully created your first SQL trigger binding! Checkout [Trigger Samples](#trigger-samples) for more information on how to use it and explore on your own!
346+
300347
301348
### JavaScript functions
302349
@@ -484,46 +531,6 @@ Note: This tutorial requires that a SQL database is setup as shown in [Create a
484531
- Hit 'F5' to run your code. Click the link to upsert the output array values in your SQL table. Your upserted values should launch in the browser.
485532
- Congratulations! You have successfully created your first SQL output binding! Checkout [Output Binding](#Output-Binding) for more information on how to use it and explore on your own!
486533
487-
### Trigger Binding Tutorial
488-
489-
Note: This tutorial requires that a SQL database is setup as shown in [Create a SQL Server](#create-a-sql-server), and that you have the 'Employee.cs' file from the [Input Binding Tutorial](#input-binding-tutorial).
490-
491-
- Create a new file with the following content:
492-
493-
```csharp
494-
using System.Collections.Generic;
495-
using Microsoft.Azure.WebJobs;
496-
using Microsoft.Extensions.Logging;
497-
using Microsoft.Azure.WebJobs.Extensions.Sql;
498-
499-
namespace Company.Function
500-
{
501-
public static class EmployeeTrigger
502-
{
503-
[FunctionName("EmployeeTrigger")]
504-
public static void Run(
505-
[SqlTrigger("[dbo].[Employees]", ConnectionStringSetting = "SqlConnectionString")]
506-
IReadOnlyList<SqlChange<Employee>> changes,
507-
ILogger logger)
508-
{
509-
foreach (SqlChange<Employee> change in changes)
510-
{
511-
Employee employee = change.Item;
512-
logger.LogInformation($"Change operation: {change.Operation}");
513-
logger.LogInformation($"EmployeeID: {employee.EmployeeId}, FirstName: {employee.FirstName}, LastName: {employee.LastName}, Company: {employee.Company}, Team: {employee.Team}");
514-
}
515-
}
516-
}
517-
}
518-
```
519-
520-
- *Skip these steps if you have not completed the output binding tutorial.*
521-
- Open your output binding file and modify some of the values. For example, change the value of Team column from 'Functions' to 'Azure SQL'.
522-
- Hit 'F5' to run your code. Click the link of the HTTP trigger from the output binding tutorial.
523-
- Update, insert, or delete rows in your SQL table while the function app is running and observe the function logs.
524-
- You should see the new log messages in the Visual Studio Code terminal containing the values of row-columns after the update operation.
525-
- Congratulations! You have successfully created your first SQL trigger binding! Checkout [Trigger Samples](#trigger-samples) for more information on how to use it and explore on your own!
526-
527534
## More Samples
528535
529536
### Input Binding

0 commit comments

Comments
 (0)