Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEJ committed Aug 5, 2024
1 parent 1d01eec commit a30a4d8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/DacpacTool/BuildOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@

namespace MSBuild.Sdk.SqlProj.DacpacTool
{
internal class BuildOptions : BaseOptions
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1819:Properties should not return arrays", Justification = "Used a DTO")]
public class BuildOptions : BaseOptions
{
public string Name { get; set; }
public string Version { get; set; }
public FileInfo Output { get; set; }
public SqlServerVersion SqlServerVersion { get; set; }
public FileInfo InputFile { get; set; }

public string[] Reference { get; set; }
public string[] BuildProperty { get; set; }
public string[] DeployProperty { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/DacpacTool/DatabaseProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace MSBuild.Sdk.SqlProj.DacpacTool
{
internal class DatabaseProperty
internal sealed class DatabaseProperty
{
private DatabaseProperty(string name, string value)
{
Expand Down
4 changes: 3 additions & 1 deletion src/DacpacTool/DeployOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace MSBuild.Sdk.SqlProj.DacpacTool
{
internal class DeployOptions : BaseOptions
#pragma warning disable CA1812 // Avoid uninstantiated internal classes
internal sealed class DeployOptions : BaseOptions
#pragma warning restore CA1812 // Avoid uninstantiated internal classes
{
public FileInfo Input { get; set; }
public string TargetServerName { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions src/DacpacTool/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

namespace MSBuild.Sdk.SqlProj.DacpacTool
{
#pragma warning disable CA1724 // Type names should not match namespaces
public static class Extensions
#pragma warning restore CA1724 // Type names should not match namespaces
{
public static string Format(this BatchErrorEventArgs args, string source)
{
Expand Down
2 changes: 1 addition & 1 deletion src/DacpacTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace MSBuild.Sdk.SqlProj.DacpacTool
{
class Program
sealed class Program
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments", Justification = "Not called repeatedly")]
static async Task<int> Main(string[] args)
Expand Down
8 changes: 7 additions & 1 deletion src/DacpacTool/PropertyParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace MSBuild.Sdk.SqlProj.DacpacTool
/// <summary>
/// Allows to parse properties from build or deploy options
/// </summary>
internal static class PropertyParser
public static class PropertyParser
{
private static readonly Dictionary<string, Func<string, object>> CustomParsers = new Dictionary<string, Func<string, object>>();

Expand All @@ -29,6 +29,8 @@ static PropertyParser()
/// <returns>The <see cref="DacDeployOptions"/> object</returns>
public static DacDeployOptions ExtractDeployOptions(this BuildOptions options)
{
ArgumentNullException.ThrowIfNull(options);

var deployOptions = new DacDeployOptions();

if (options.DeployProperty != null)
Expand All @@ -49,6 +51,8 @@ private static PropertyInfo GetDacDeployOptionsProperty(string propertyName)

public static ObjectType[] ParseObjectTypes(string value)
{
ArgumentNullException.ThrowIfNull(value);

if (value.Contains(';', StringComparison.OrdinalIgnoreCase))
{
throw new ArgumentException("Expected object types to be comma-seperated instead of semi-colon separated");
Expand All @@ -72,6 +76,8 @@ public static ObjectType[] ParseObjectTypes(string value)

public static DacAzureDatabaseSpecification ParseDatabaseSpecification(string value)
{
ArgumentNullException.ThrowIfNull(value);

if (value.Contains(';', StringComparison.OrdinalIgnoreCase))
{
throw new ArgumentException("Expected database specification to be comma-seperated instead of semi-colon separated");
Expand Down

0 comments on commit a30a4d8

Please sign in to comment.