Skip to content

Commit 2d7a6c5

Browse files
Merge pull request #794 from Azure/chgagnon/mergeMain
[Trigger] Merge latest from main
2 parents a1c42c2 + f3522e2 commit 2d7a6c5

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

builds/azure-pipelines/template-steps-build-test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ steps:
102102
targetFolder: $(azureFunctionsExtensionBundlePath)/bin
103103
overWrite: true
104104

105+
# Copy the Sql nupkg to ensure it's available for tests since the package copy task is failing occasionally so having this redundancy.
106+
- task: CopyFiles@2
107+
displayName: 'Copy local Sql package to local-packages folder'
108+
inputs:
109+
sourceFolder: $(Build.SourcesDirectory)/src/bin/${{ parameters.configuration }}
110+
contents: '*.nupkg'
111+
targetFolder: $(Build.SourcesDirectory)/local-packages
112+
overWrite: true
113+
105114
- script: |
106115
npm install
107116
npm run lint

src/SqlAttribute.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ public SqlAttribute(string commandText, string connectionStringSetting, CommandT
3838
/// <param name="connectionStringSetting">The name of the app setting where the SQL connection string is stored</param>
3939
public SqlAttribute(string commandText, string connectionStringSetting) : this(commandText, connectionStringSetting, CommandType.Text, null) { }
4040

41+
/// <summary>
42+
/// Initializes a new instance of the <see cref="SqlAttribute"/> class with the default value for the CommandType.
43+
/// </summary>
44+
/// <param name="commandText">For an input binding, either a SQL query or stored procedure that will be run in the database. For an output binding, the table name to upsert the values to.</param>
45+
/// <param name="connectionStringSetting">The name of the app setting where the SQL connection string is stored</param>
46+
/// <param name="parameters">Specifies the parameters that will be used to execute the SQL query or stored procedure. See <see cref="Parameters"/> for more details.</param>
47+
public SqlAttribute(string commandText, string connectionStringSetting, string parameters) : this(commandText, connectionStringSetting, CommandType.Text, parameters) { }
48+
4149
/// <summary>
4250
/// The name of the app setting where the SQL connection string is stored
4351
/// (see https://docs.microsoft.com/dotnet/api/microsoft.data.sqlclient.sqlconnection).

src/SqlBindingUtilities.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ public static string GetConnectionString(string connectionStringSetting, IConfig
4545
{
4646
throw new ArgumentNullException(nameof(configuration));
4747
}
48-
return configuration.GetConnectionStringOrSetting(connectionStringSetting);
48+
string connectionString = configuration.GetConnectionStringOrSetting(connectionStringSetting);
49+
if (string.IsNullOrEmpty(connectionString))
50+
{
51+
throw new ArgumentException(connectionString == null ? $"ConnectionStringSetting '{connectionStringSetting}' is missing in your function app settings, please add the setting with a valid SQL connection string." :
52+
$"ConnectionStringSetting '{connectionStringSetting}' is empty in your function app settings, please update the setting with a valid SQL connection string.");
53+
}
54+
return connectionString;
4955
}
5056

5157
/// <summary>

0 commit comments

Comments
 (0)