Repository navigation
Enable nullable reference types in DacpacTool #1046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,52 +9,52 @@ namespace MSBuild.Sdk.SqlProj.DacpacTool | |
| public class BuildOptions : BaseOptions | ||
| { | ||
| [CliOption(Description = "Name of the package", Required = true, Name = "--name", Alias = "-n")] | ||
| public string Name { get; set; } | ||
| public string Name { get; set; } = null!; | ||
|
|
||
| [CliOption(Description = "Version of the package", Required = false, Name = "--version", Alias = "-v")] | ||
| public string Version { get; set; } | ||
| public string? Version { get; set; } | ||
|
|
||
| [CliOption(Description = "Filename of the output package", Required = false, Name = "--output", Alias = "-o")] | ||
| public FileInfo Output { get; set; } | ||
| public FileInfo? Output { get; set; } | ||
|
|
||
| [CliOption(Description = "Target version of the model", Required = false, Name = "--sqlServerVersion", Alias = "-sv")] | ||
| public SqlServerVersion SqlServerVersion { get; set; } = SqlServerVersion.Sql170; | ||
|
|
||
| [CliOption(Description = "Text file listing all input files", Name = "--inputfile", Required = false, Alias = "-i")] | ||
| public FileInfo InputFile { get; set; } | ||
| public FileInfo? InputFile { get; set; } | ||
|
|
||
| [CliOption(Description = "Reference(s) to include", Required = false, Name = "--reference", Alias = "-r")] | ||
| public string[] Reference { get; set; } | ||
| public string[]? Reference { get; set; } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps we should initialize these array arguments to empty arrays rather than making them nullable? Then wherever we're reading them we don't have to check for |
||
|
|
||
| [CliOption(Description = "Build properties to be set on the model", Name = "--buildproperty", Required = false, Alias = "-bp")] | ||
| public string[] BuildProperty { get; set; } | ||
| public string[]? BuildProperty { get; set; } | ||
|
|
||
| [CliOption(Description = "Deploy properties to be set for the create script", Name = "--deployproperty", Required = false, Alias = "-dp")] | ||
| public string[] DeployProperty { get; set; } | ||
| public string[]? DeployProperty { get; set; } | ||
|
|
||
| [CliOption(Description = "SqlCmdVariable(s) to include", Name = "--sqlcmdvar", Required = false, Alias = "-sc")] | ||
| public string[] SqlCmdVar { get; set; } | ||
| public string[]? SqlCmdVar { get; set; } | ||
|
|
||
| [CliOption(Description = "Filename of optional pre-deployment script", Name = "--predeploy", Required = false)] | ||
| public FileInfo PreDeploy { get; set; } | ||
| public FileInfo? PreDeploy { get; set; } | ||
|
|
||
| [CliOption(Description = "Filename of optional pre-plan script", Name = "--preplan", Required = false)] | ||
| public FileInfo PrePlan { get; set; } | ||
| public FileInfo? PrePlan { get; set; } | ||
|
|
||
| [CliOption(Description = "Filename of optional post-deployment script", Name = "--postdeploy", Required = false)] | ||
| public FileInfo PostDeploy { get; set; } | ||
| public FileInfo? PostDeploy { get; set; } | ||
|
|
||
| [CliOption(Description = "Filename of optional refactor log script", Name = "--refactorlog", Required = false)] | ||
| public FileInfo RefactorLog { get; set; } | ||
| public FileInfo? RefactorLog { get; set; } | ||
|
|
||
| [CliOption(Description = "Run static code analysis", Name = "--runcodeanalysis", Required = false, Alias = "-an")] | ||
| public bool RunCodeAnalysis { get; set; } | ||
|
|
||
| [CliOption(Description = "List of rules to suppress in format '-Microsoft.Rules.Data.SR0001;-Microsoft.Rules.Data.SR0008'", Name = "--codeanalysisrules", Required = false, Alias = "-ar")] | ||
| public string CodeAnalysisRules { get; set; } | ||
| public string? CodeAnalysisRules { get; set; } | ||
|
|
||
| [CliOption(Description = "Custom code analysis rule assemblies to use", Name = "--codeanalysisassemblies", Required = false, Alias = "-aa")] | ||
| public FileInfo[] CodeAnalysisAssemblies { get; set; } | ||
| public FileInfo[]? CodeAnalysisAssemblies { get; set; } | ||
|
|
||
| [CliOption(Description = "Treat T-SQL Warnings As Errors", Name = "--warnaserror", Required = false)] | ||
| public bool WarnAsError { get; set; } | ||
|
|
@@ -63,22 +63,22 @@ public class BuildOptions : BaseOptions | |
| public bool GenerateCreateScript { get; set; } | ||
|
|
||
| [CliOption(Description = "Name of the database to use in the generated create script", Name = "--targetdatabasename", Required = false, Alias = "-tdn")] | ||
| public string TargetDatabaseName { get; set; } | ||
| public string? TargetDatabaseName { get; set; } | ||
|
|
||
| [CliOption(Description = "Warning(s) to suppress", Name = "--suppresswarnings", Required = false, Alias = "-spw")] | ||
| public string SuppressWarnings { get; set; } | ||
| public string? SuppressWarnings { get; set; } | ||
|
|
||
| [CliOption(Description = "Filename for warning(s) to suppress for particular files", Name = "--suppresswarningslistfile", Required = false, Alias = "-spl")] | ||
| public FileInfo SuppressWarningsListFile { get; set; } | ||
| public FileInfo? SuppressWarningsListFile { get; set; } | ||
|
|
||
| [CliOption(Description = "Generate ER diagram from the dacpac", Name = "--generateerdiagram", Required = false, Alias = "-ged")] | ||
| public bool GenerateErDiagram { get; set; } | ||
|
|
||
| [CliOption(Description = "JSON config file for ER diagram generation", Name = "--erdiagramconfig", Required = false, Alias = "-edc")] | ||
| public FileInfo[] ErDiagramConfig { get; set; } | ||
| public FileInfo[]? ErDiagramConfig { get; set; } | ||
|
|
||
| [CliOption(Description = "Optional ProjectGuid", Name = "--projectguid", Required = false, Alias = "-pg")] | ||
| public string ProjectGuid { get; set; } | ||
| public string? ProjectGuid { get; set; } | ||
|
|
||
| public async Task<int> RunAsync() | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,28 +9,28 @@ internal sealed class DeployOptions : BaseOptions | |
| #pragma warning restore CA1812 // Avoid uninstantiated internal classes | ||
| { | ||
| [CliOption(Description = "Path to the .dacpac package to deploy", Required = true, Name = "--input", Alias = "-i")] | ||
| public FileInfo Input { get; set; } | ||
| public FileInfo Input { get; set; } = null!; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could it be the "required" keword iso null! ? |
||
|
|
||
| [CliOption(Description = "Name of the server to deploy the package to", Required = true, Name = "--targetServerName", Alias = "-tsn")] | ||
| public string TargetServerName { get; set; } | ||
| public string TargetServerName { get; set; } = null!; | ||
|
|
||
| [CliOption(Description = "Port number to connect on (leave blank for default)", Name = "--targetPort", Required = false, Alias = "-tprt")] | ||
| public int? TargetPort { get; set; } | ||
|
|
||
| [CliOption(Description = "Name of the database to deploy the package to", Required = true, Name = "--targetDatabaseName", Alias = "-tdn")] | ||
| public string TargetDatabaseName { get; set; } | ||
| public string TargetDatabaseName { get; set; } = null!; | ||
|
|
||
| [CliOption(Description = "Username used to connect to the target server, using SQL Server authentication", Required = false, Name = "--targetUser", Alias = "-tu")] | ||
| public string TargetUser { get; set; } | ||
| public string? TargetUser { get; set; } | ||
|
|
||
| [CliOption(Description = "Password used to connect to the target server, using SQL Server authentication", Required = false, Name = "--targetPassword", Alias = "-tp")] | ||
| public string TargetPassword { get; set; } | ||
| public string? TargetPassword { get; set; } | ||
|
|
||
| [CliOption(Description = "Properties used to control the deployment", Required = false, Name = "--property", Alias = "-p")] | ||
| public string[] Property { get; set; } | ||
| public string[]? Property { get; set; } | ||
|
|
||
| [CliOption(Description = "SqlCmdVariable(s) and their associated values, separated by an equals sign", Name = "--sqlcmdvar", Required = false, Alias = "-sc")] | ||
| public string[] SqlCmdVar { get; set; } | ||
| public string[]? SqlCmdVar { get; set; } | ||
|
|
||
| [CliOption(Description = "Whether to run pre- and postdeployment scripts from references", Name = "--runScriptsFromReferences", Required = false, Alias = "-sff")] | ||
| public bool RunScriptsFromReferences { get; set; } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be "required" ??