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
9 changes: 9 additions & 0 deletions builds/azure-pipelines/template-steps-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ steps:
targetFolder: $(azureFunctionsExtensionBundlePath)/bin
overWrite: true

# Copy the Sql nupkg to ensure it's available for tests since the package copy task is failing occasionally so having this redundancy.
- task: CopyFiles@2
displayName: 'Copy local Sql package to local-packages folder'
inputs:
sourceFolder: $(Build.SourcesDirectory)/src/bin/${{ parameters.configuration }}
contents: '*.nupkg'
targetFolder: $(Build.SourcesDirectory)/local-packages
overWrite: true

- script: |
npm install
npm run lint
Expand Down
8 changes: 8 additions & 0 deletions src/SqlAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ public SqlAttribute(string commandText, string connectionStringSetting, CommandT
/// <param name="connectionStringSetting">The name of the app setting where the SQL connection string is stored</param>
public SqlAttribute(string commandText, string connectionStringSetting) : this(commandText, connectionStringSetting, CommandType.Text, null) { }

/// <summary>
/// Initializes a new instance of the <see cref="SqlAttribute"/> class with the default value for the CommandType.
/// </summary>
/// <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>
/// <param name="connectionStringSetting">The name of the app setting where the SQL connection string is stored</param>
/// <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>
public SqlAttribute(string commandText, string connectionStringSetting, string parameters) : this(commandText, connectionStringSetting, CommandType.Text, parameters) { }

/// <summary>
/// The name of the app setting where the SQL connection string is stored
/// (see https://docs.microsoft.com/dotnet/api/microsoft.data.sqlclient.sqlconnection).
Expand Down
8 changes: 7 additions & 1 deletion src/SqlBindingUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ public static string GetConnectionString(string connectionStringSetting, IConfig
{
throw new ArgumentNullException(nameof(configuration));
}
return configuration.GetConnectionStringOrSetting(connectionStringSetting);
string connectionString = configuration.GetConnectionStringOrSetting(connectionStringSetting);
if (string.IsNullOrEmpty(connectionString))
{
throw new ArgumentException(connectionString == null ? $"ConnectionStringSetting '{connectionStringSetting}' is missing in your function app settings, please add the setting with a valid SQL connection string." :
$"ConnectionStringSetting '{connectionStringSetting}' is empty in your function app settings, please update the setting with a valid SQL connection string.");
}
return connectionString;
}

/// <summary>
Expand Down