diff --git a/Directory.Packages.props b/Directory.Packages.props index db173b3ca..33d333243 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,7 +1,7 @@ - + diff --git a/samples/samples-csharp/packages.lock.json b/samples/samples-csharp/packages.lock.json index 8aa0987b9..10f368f07 100644 --- a/samples/samples-csharp/packages.lock.json +++ b/samples/samples-csharp/packages.lock.json @@ -14,9 +14,9 @@ }, "Microsoft.NET.Sdk.Functions": { "type": "Direct", - "requested": "[3.0.13, )", - "resolved": "3.0.13", - "contentHash": "8BEt6I6OLm7fo9bh8VGI7Mkc7xs/vI/KDira8MQcfZIA+K+lmDRb2PAL/+728eYfXI4SVrGs4MLhUZvKtpWfvQ==", + "requested": "[3.1.1, )", + "resolved": "3.1.1", + "contentHash": "sPPLAjDYroeuIDKwff5B1XrwvGzJm9K9GabXurmfpaXa3M4POy7ngLcG5mm+2pwjTA7e870pIjt1N2DqVQS4yA==", "dependencies": { "Microsoft.Azure.Functions.Analyzers": "[1.0.0, 2.0.0)", "Microsoft.Azure.WebJobs": "[3.0.23, 3.1.0)", diff --git a/src/SqlAttribute.cs b/src/SqlAttribute.cs index 0e0c19745..a7a89aad4 100644 --- a/src/SqlAttribute.cs +++ b/src/SqlAttribute.cs @@ -47,7 +47,7 @@ public SqlAttribute(string commandText) /// Specifies whether refers to a stored procedure or SQL query string. /// Use for the former, for the latter /// - public CommandType CommandType { get; set; } + public CommandType CommandType { get; set; } = CommandType.Text; /// /// Specifies the parameters that will be used to execute the SQL query or stored procedure specified in . diff --git a/test/Unit/SqlInputBindingTests.cs b/test/Unit/SqlInputBindingTests.cs index 63e1f501a..feab46991 100644 --- a/test/Unit/SqlInputBindingTests.cs +++ b/test/Unit/SqlInputBindingTests.cs @@ -95,11 +95,18 @@ public void TestInvalidCommandType() CommandType = System.Data.CommandType.TableDirect }; Assert.Throws(() => SqlBindingUtilities.BuildCommand(attribute, null)); + } + [Fact] + public void TestDefaultCommandType() + { + string query = "select * from Products"; + var attribute = new SqlAttribute(query); + SqlCommand command = SqlBindingUtilities.BuildCommand(attribute, null); + // CommandType should default to Text + Assert.Equal(System.Data.CommandType.Text, command.CommandType); + Assert.Equal(query, command.CommandText); - // Don't specify a type at all - attribute = new SqlAttribute(""); - Assert.Throws(() => SqlBindingUtilities.BuildCommand(attribute, null)); } [Fact] diff --git a/test/packages.lock.json b/test/packages.lock.json index 70a930216..ea769cbc0 100644 --- a/test/packages.lock.json +++ b/test/packages.lock.json @@ -4,9 +4,9 @@ ".NETCoreApp,Version=v3.1": { "Microsoft.NET.Sdk.Functions": { "type": "Direct", - "requested": "[3.0.13, )", - "resolved": "3.0.13", - "contentHash": "8BEt6I6OLm7fo9bh8VGI7Mkc7xs/vI/KDira8MQcfZIA+K+lmDRb2PAL/+728eYfXI4SVrGs4MLhUZvKtpWfvQ==", + "requested": "[3.1.1, )", + "resolved": "3.1.1", + "contentHash": "sPPLAjDYroeuIDKwff5B1XrwvGzJm9K9GabXurmfpaXa3M4POy7ngLcG5mm+2pwjTA7e870pIjt1N2DqVQS4yA==", "dependencies": { "Microsoft.Azure.Functions.Analyzers": "[1.0.0, 2.0.0)", "Microsoft.Azure.WebJobs": "[3.0.23, 3.1.0)", @@ -1938,9 +1938,9 @@ "microsoft.azure.webjobs.extensions.sql.samples": { "type": "Project", "dependencies": { - "Microsoft.Azure.WebJobs.Extensions.Sql": "1.0.0", + "Microsoft.Azure.WebJobs.Extensions.Sql": "99.99.99", "Microsoft.Azure.WebJobs.Extensions.Storage": "5.0.0", - "Microsoft.NET.Sdk.Functions": "3.0.13" + "Microsoft.NET.Sdk.Functions": "3.1.1" } }, "Microsoft.ApplicationInsights": {