diff --git a/src/DacpacTool/BuildOptions.cs b/src/DacpacTool/BuildOptions.cs index 2df84a9d..3f8b488a 100644 --- a/src/DacpacTool/BuildOptions.cs +++ b/src/DacpacTool/BuildOptions.cs @@ -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; } diff --git a/src/DacpacTool/DatabaseProperty.cs b/src/DacpacTool/DatabaseProperty.cs index 595ac161..76d8466b 100644 --- a/src/DacpacTool/DatabaseProperty.cs +++ b/src/DacpacTool/DatabaseProperty.cs @@ -2,7 +2,7 @@ namespace MSBuild.Sdk.SqlProj.DacpacTool { - internal class DatabaseProperty + internal sealed class DatabaseProperty { private DatabaseProperty(string name, string value) { diff --git a/src/DacpacTool/DeployOptions.cs b/src/DacpacTool/DeployOptions.cs index d2582ea1..b43870ae 100644 --- a/src/DacpacTool/DeployOptions.cs +++ b/src/DacpacTool/DeployOptions.cs @@ -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; } diff --git a/src/DacpacTool/Extensions.cs b/src/DacpacTool/Extensions.cs index de054c02..1e382cc4 100644 --- a/src/DacpacTool/Extensions.cs +++ b/src/DacpacTool/Extensions.cs @@ -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) { diff --git a/src/DacpacTool/Program.cs b/src/DacpacTool/Program.cs index 75311981..29f18c05 100644 --- a/src/DacpacTool/Program.cs +++ b/src/DacpacTool/Program.cs @@ -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 Main(string[] args) diff --git a/src/DacpacTool/PropertyParser.cs b/src/DacpacTool/PropertyParser.cs index 0d58a4ec..0f9a6094 100644 --- a/src/DacpacTool/PropertyParser.cs +++ b/src/DacpacTool/PropertyParser.cs @@ -11,7 +11,7 @@ namespace MSBuild.Sdk.SqlProj.DacpacTool /// /// Allows to parse properties from build or deploy options /// - internal static class PropertyParser + public static class PropertyParser { private static readonly Dictionary> CustomParsers = new Dictionary>(); @@ -29,6 +29,8 @@ static PropertyParser() /// The object public static DacDeployOptions ExtractDeployOptions(this BuildOptions options) { + ArgumentNullException.ThrowIfNull(options); + var deployOptions = new DacDeployOptions(); if (options.DeployProperty != null) @@ -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"); @@ -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");