From the course: Azure Functions for Developers

Unlock the full course today

Join today to access over 25,100 courses taught by industry experts.

Implementing the SqlOutput trigger in the Register function

Implementing the SqlOutput trigger in the Register function - Azure Tutorial

From the course: Azure Functions for Developers

Implementing the SqlOutput trigger in the Register function

- [Instructor] The register function is only returning the website object that is being deserialized. Nothing fancy or tricky here. Let's modify the function to store the website registration as a record in a SQL Server database. To do this, we're going to use a SQL output binding. So we need to add a new nugget package reference, which is Microsoft Azure, functions, worker, extensions, SQL, this is the package. So let's click on install and accept the dialogue. And let's close this and let's return to the code. The SQL output binding is an attribute that you can use to decorate the existing method. So SQL output is the name and it has two parameters. The first one is the table name that you want to use for inserting or updating the records. In this case, I'm going to use DBO, which is the schema, and then websites. So we need to create this table in the database and also we need to specify the name of the connection string configuration. So in this case, I'm going to use website…

Contents