diff --git a/Worker.Extensions.Sql/src/Microsoft.Azure.Functions.Worker.Extensions.Sql.csproj b/Worker.Extensions.Sql/src/Microsoft.Azure.Functions.Worker.Extensions.Sql.csproj
index 42c0e8f3..81b5fc91 100644
--- a/Worker.Extensions.Sql/src/Microsoft.Azure.Functions.Worker.Extensions.Sql.csproj
+++ b/Worker.Extensions.Sql/src/Microsoft.Azure.Functions.Worker.Extensions.Sql.csproj
@@ -5,7 +5,7 @@
Microsoft.Azure.Functions.Worker.Extensions.Sql
Sql extension for .NET isolated Azure Functions
SQL Binding Worker
- net6
+ net8.0
99.99.99
99.99.99
diff --git a/Worker.Extensions.Sql/src/SqlChange.cs b/Worker.Extensions.Sql/src/SqlChange.cs
index fa0fda37..9c7550b6 100644
--- a/Worker.Extensions.Sql/src/SqlChange.cs
+++ b/Worker.Extensions.Sql/src/SqlChange.cs
@@ -7,30 +7,25 @@ namespace Microsoft.Azure.Functions.Worker.Extensions.Sql
/// Represents the changed row in the user table.
///
/// POCO class representing the row in the user table
- public sealed class SqlChange
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Change operation
+ /// POCO representing the row in the user table on which the change operation took place
+ public sealed class SqlChange(SqlChangeOperation operation, T item)
{
- ///
- /// Initializes a new instance of the class.
- ///
- /// Change operation
- /// POCO representing the row in the user table on which the change operation took place
- public SqlChange(SqlChangeOperation operation, T item)
- {
- this.Operation = operation;
- this.Item = item;
- }
///
/// Change operation (insert, update, or delete).
///
- public SqlChangeOperation Operation { get; }
+ public SqlChangeOperation Operation { get; } = operation;
///
/// POCO representing the row in the user table on which the change operation took place. If the change
/// operation is , then only the properties corresponding to the primary
/// keys will be populated.
///
- public T Item { get; }
+ public T Item { get; } = item;
}
///
diff --git a/Worker.Extensions.Sql/src/SqlInputAttribute.cs b/Worker.Extensions.Sql/src/SqlInputAttribute.cs
index 0ce4cc65..7e15398f 100644
--- a/Worker.Extensions.Sql/src/SqlInputAttribute.cs
+++ b/Worker.Extensions.Sql/src/SqlInputAttribute.cs
@@ -7,22 +7,16 @@
namespace Microsoft.Azure.Functions.Worker.Extensions.Sql
{
- public sealed class SqlInputAttribute : InputBindingAttribute
+ ///
+ /// Creates an instance of the , which takes a SQL query or stored procedure to run and returns the output to the function.
+ ///
+ /// Either a SQL query or stored procedure that will be run in the target database.
+ /// The name of the app setting where the SQL connection string is stored
+ /// Specifies whether refers to a stored procedure or SQL query string. Defaults to
+ /// Optional - Specifies the parameters that will be used to execute the SQL query or stored procedure. See for more details.
+ public sealed class SqlInputAttribute(string commandText, string connectionStringSetting, CommandType commandType = CommandType.Text, string parameters = null) : InputBindingAttribute
{
- ///
- /// Creates an instance of the , which takes a SQL query or stored procedure to run and returns the output to the function.
- ///
- /// Either a SQL query or stored procedure that will be run in the target database.
- /// The name of the app setting where the SQL connection string is stored
- /// Specifies whether refers to a stored procedure or SQL query string. Defaults to
- /// Optional - Specifies the parameters that will be used to execute the SQL query or stored procedure. See for more details.
- public SqlInputAttribute(string commandText, string connectionStringSetting, CommandType commandType = CommandType.Text, string parameters = null)
- {
- this.CommandText = commandText ?? throw new ArgumentNullException(nameof(commandText));
- this.ConnectionStringSetting = connectionStringSetting ?? throw new ArgumentNullException(nameof(connectionStringSetting));
- this.CommandType = commandType;
- this.Parameters = parameters;
- }
+
///
/// Creates an instance of the , which takes a SQL query or stored procedure to run and returns the output to the function.
@@ -40,19 +34,19 @@ public SqlInputAttribute(string commandText, string connectionStringSetting) : t
/// create a ConnectionStringSetting with a name like SqlServerAuthentication. The value of the SqlServerAuthentication app setting
/// would look like "Data Source=test.database.windows.net;Database=TestDB;User ID={userid};Password={password}".
///
- public string ConnectionStringSetting { get; }
+ public string ConnectionStringSetting { get; } = connectionStringSetting ?? throw new ArgumentNullException(nameof(connectionStringSetting));
///
/// Either a SQL query or stored procedure that will be run in the target database.
///
- public string CommandText { get; }
+ public string CommandText { get; } = commandText ?? throw new ArgumentNullException(nameof(commandText));
///
/// Specifies whether refers to a stored procedure or SQL query string.
/// Use for the former, for the latter.
/// Defaults to .
///
- public CommandType CommandType { get; }
+ public CommandType CommandType { get; } = commandType;
///
/// Specifies the parameters that will be used to execute the SQL query or stored procedure specified in .
@@ -63,6 +57,6 @@ public SqlInputAttribute(string commandText, string connectionStringSetting) : t
/// as in "@param1=,@param2=param2"
/// Note that neither the parameter name nor the parameter value can have ',' or '='
///
- public string Parameters { get; }
+ public string Parameters { get; } = parameters;
}
}
diff --git a/Worker.Extensions.Sql/src/SqlOutputAttribute.cs b/Worker.Extensions.Sql/src/SqlOutputAttribute.cs
index 0e762e3f..e068eedc 100644
--- a/Worker.Extensions.Sql/src/SqlOutputAttribute.cs
+++ b/Worker.Extensions.Sql/src/SqlOutputAttribute.cs
@@ -6,18 +6,14 @@
namespace Microsoft.Azure.Functions.Worker.Extensions.Sql
{
- public class SqlOutputAttribute : OutputBindingAttribute
+ ///
+ /// Creates an instance of the , which takes a list of rows and upserts them into the target table.
+ ///
+ /// The table name to upsert the values to.
+ /// The name of the app setting where the SQL connection string is stored
+ public class SqlOutputAttribute(string commandText, string connectionStringSetting) : OutputBindingAttribute
{
- ///
- /// Creates an instance of the , which takes a list of rows and upserts them into the target table.
- ///
- /// The table name to upsert the values to.
- /// The name of the app setting where the SQL connection string is stored
- public SqlOutputAttribute(string commandText, string connectionStringSetting)
- {
- this.CommandText = commandText ?? throw new ArgumentNullException(nameof(commandText));
- this.ConnectionStringSetting = connectionStringSetting ?? throw new ArgumentNullException(nameof(connectionStringSetting));
- }
+
///
/// The name of the app setting where the SQL connection string is stored
@@ -28,11 +24,11 @@ public SqlOutputAttribute(string commandText, string connectionStringSetting)
/// create a ConnectionStringSetting with a name like SqlServerAuthentication. The value of the SqlServerAuthentication app setting
/// would look like "Data Source=test.database.windows.net;Database=TestDB;User ID={userid};Password={password}".
///
- public string ConnectionStringSetting { get; }
+ public string ConnectionStringSetting { get; } = connectionStringSetting ?? throw new ArgumentNullException(nameof(connectionStringSetting));
///
/// The table name to upsert the values to.
///
- public string CommandText { get; }
+ public string CommandText { get; } = commandText ?? throw new ArgumentNullException(nameof(commandText));
}
}
diff --git a/Worker.Extensions.Sql/src/SqlTriggerAttribute.cs b/Worker.Extensions.Sql/src/SqlTriggerAttribute.cs
index e756c1de..1f26fbb9 100644
--- a/Worker.Extensions.Sql/src/SqlTriggerAttribute.cs
+++ b/Worker.Extensions.Sql/src/SqlTriggerAttribute.cs
@@ -6,20 +6,15 @@
namespace Microsoft.Azure.Functions.Worker.Extensions.Sql
{
- public sealed class SqlTriggerAttribute : TriggerBindingAttribute
+ ///
+ /// Initializes a new instance of the class, which triggers the function when any changes on the specified table are detected.
+ ///
+ /// Name of the table to watch for changes.
+ /// The name of the app setting where the SQL connection string is stored
+ /// Optional - The name of the table used to store leases. If not specified, the leases table name will be Leases_{FunctionId}_{TableId}
+ public sealed class SqlTriggerAttribute(string tableName, string connectionStringSetting, string leasesTableName = null) : TriggerBindingAttribute
{
- ///
- /// Initializes a new instance of the class, which triggers the function when any changes on the specified table are detected.
- ///
- /// Name of the table to watch for changes.
- /// The name of the app setting where the SQL connection string is stored
- /// Optional - The name of the table used to store leases. If not specified, the leases table name will be Leases_{FunctionId}_{TableId}
- public SqlTriggerAttribute(string tableName, string connectionStringSetting, string leasesTableName = null)
- {
- this.TableName = tableName ?? throw new ArgumentNullException(nameof(tableName));
- this.ConnectionStringSetting = connectionStringSetting ?? throw new ArgumentNullException(nameof(connectionStringSetting));
- this.LeasesTableName = leasesTableName;
- }
+
///
/// Initializes a new instance of the class with null value for LeasesTableName.
@@ -31,12 +26,12 @@ public SqlTriggerAttribute(string tableName, string connectionStringSetting) : t
///
/// Name of the app setting containing the SQL connection string.
///
- public string ConnectionStringSetting { get; }
+ public string ConnectionStringSetting { get; } = connectionStringSetting ?? throw new ArgumentNullException(nameof(connectionStringSetting));
///
/// Name of the table to watch for changes.
///
- public string TableName { get; }
+ public string TableName { get; } = tableName ?? throw new ArgumentNullException(nameof(tableName));
///
/// Name of the table used to store leases.
@@ -44,6 +39,6 @@ public SqlTriggerAttribute(string tableName, string connectionStringSetting) : t
/// More information on how this is generated can be found here
/// https://github.com/Azure/azure-functions-sql-extension/blob/main/docs/TriggerBinding.md#az_funcleasestablename
///
- public string LeasesTableName { get; }
+ public string LeasesTableName { get; } = leasesTableName;
}
}
\ No newline at end of file
diff --git a/Worker.Extensions.Sql/src/packages.lock.json b/Worker.Extensions.Sql/src/packages.lock.json
index ed54636f..be12a5de 100644
--- a/Worker.Extensions.Sql/src/packages.lock.json
+++ b/Worker.Extensions.Sql/src/packages.lock.json
@@ -1,7 +1,7 @@
{
"version": 2,
"dependencies": {
- "net6.0": {
+ "net8.0": {
"Microsoft.Azure.Functions.Worker.Extensions.Abstractions": {
"type": "Direct",
"requested": "[1.3.0, )",
diff --git a/builds/azure-pipelines/template-steps-build-test.yml b/builds/azure-pipelines/template-steps-build-test.yml
index c2648505..97998eb5 100644
--- a/builds/azure-pipelines/template-steps-build-test.yml
+++ b/builds/azure-pipelines/template-steps-build-test.yml
@@ -32,9 +32,7 @@ steps:
inputs:
workingFile: $(Build.SourcesDirectory)/${{ parameters.sourcesSubdirectory }}/.npmrc
-# Temporarily install Azure Functions Core Tools 4.0.7317 as the latest version (4.0.7512) causes 11 Python tests to fail
-# Tracking issue: https://github.com/Azure/azure-functions-sql-extension/issues/1193
-- script: npm install azure-functions-core-tools@4.0.7317 --global --globalconfig $(Build.SourcesDirectory)/${{ parameters.sourcesSubdirectory }}/.npmrc --loglevel verbose
+- script: npm install azure-functions-core-tools --global --globalconfig $(Build.SourcesDirectory)/${{ parameters.sourcesSubdirectory }}/.npmrc --loglevel verbose
displayName: 'Install Azure Functions Core Tools'
- script: npm install azurite --global --globalconfig $(Build.SourcesDirectory)/${{ parameters.sourcesSubdirectory }}/.npmrc --loglevel verbose