Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<ItemGroup>
<PackageVersion Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="5.0.0" />
<PackageVersion Include="Microsoft.NET.Sdk.Functions" Version="3.0.13" />
<PackageVersion Include="Microsoft.NET.Sdk.Functions" Version="3.1.1" />
<PackageVersion Include="Microsoft.ApplicationInsights" Version="2.17.0" />
<PackageVersion Include="Microsoft.Azure.WebJobs" Version="3.0.31" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="3.0.1" />
Expand Down
6 changes: 3 additions & 3 deletions samples/samples-csharp/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
2 changes: 1 addition & 1 deletion src/SqlAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public SqlAttribute(string commandText)
/// Specifies whether <see cref="CommandText"/> refers to a stored procedure or SQL query string.
/// Use <see cref="CommandType.StoredProcedure"/> for the former, <see cref="CommandType.Text"/> for the latter
/// </summary>
public CommandType CommandType { get; set; }
public CommandType CommandType { get; set; } = CommandType.Text;

/// <summary>
/// Specifies the parameters that will be used to execute the SQL query or stored procedure specified in <see cref="CommandText"/>.
Expand Down
13 changes: 10 additions & 3 deletions test/Unit/SqlInputBindingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,18 @@ public void TestInvalidCommandType()
CommandType = System.Data.CommandType.TableDirect
};
Assert.Throws<ArgumentException>(() => 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<ArgumentException>(() => SqlBindingUtilities.BuildCommand(attribute, null));
}

[Fact]
Expand Down
10 changes: 5 additions & 5 deletions test/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down Expand Up @@ -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": {
Expand Down