Skip to content

Commit

Permalink
Fix analyzer warnings from the .NET 9 SDK (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEJ authored Oct 11, 2024
1 parent a237ebc commit 2ae97d2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,6 @@ visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public

[**/Microsoft.SqlTools.ManagedBatchParser/**.cs]
generated_code = true

# Ignored rules
dotnet_diagnostic.CA1515.severity = none #CA1515: Consider making public types internal
28 changes: 14 additions & 14 deletions src/DacpacTool/PackageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,14 @@ public void SetProperty(string key, string value)
try
{
// Convert value into the appropriate type depending on the key
var propertyValue = key switch
object propertyValue = key switch
{
"QueryStoreIntervalLength" => int.Parse(value, CultureInfo.InvariantCulture),
"QueryStoreFlushInterval" => int.Parse(value, CultureInfo.InvariantCulture),
"QueryStoreDesiredState" => Enum.Parse(typeof(QueryStoreDesiredState), value),
"QueryStoreCaptureMode" => Enum.Parse(typeof(QueryStoreCaptureMode), value),
"ParameterizationOption" => Enum.Parse(typeof(ParameterizationOption), value),
"PageVerifyMode" => Enum.Parse(typeof(PageVerifyMode), value),
"QueryStoreDesiredState" => Enum.Parse<QueryStoreDesiredState>(value),
"QueryStoreCaptureMode" => Enum.Parse<QueryStoreCaptureMode>(value),
"ParameterizationOption" => Enum.Parse<ParameterizationOption>(value),
"PageVerifyMode" => Enum.Parse<PageVerifyMode>(value),
"QueryStoreMaxStorageSize" => int.Parse(value, CultureInfo.InvariantCulture),
"NumericRoundAbortOn" => bool.Parse(value),
"NestedTriggersOn" => bool.Parse(value),
Expand All @@ -216,7 +216,7 @@ public void SetProperty(string key, string value)
"FileStreamDirectoryName" => value,
"DbScopedConfigQueryOptimizerHotfixesSecondary" => bool.Parse(value),
"DbScopedConfigQueryOptimizerHotfixes" => bool.Parse(value),
"NonTransactedFileStreamAccess" => Enum.Parse(typeof(NonTransactedFileStreamAccess), value),
"NonTransactedFileStreamAccess" => Enum.Parse<NonTransactedFileStreamAccess>(value),
"DbScopedConfigParameterSniffingSecondary" => bool.Parse(value),
"QueryStoreMaxPlansPerQuery" => int.Parse(value, CultureInfo.InvariantCulture),
"QuotedIdentifierOn" => bool.Parse(value),
Expand All @@ -225,13 +225,13 @@ public void SetProperty(string key, string value)
"Trustworthy" => bool.Parse(value),
"TransformNoiseWords" => bool.Parse(value),
"TornPageProtectionOn" => bool.Parse(value),
"TargetRecoveryTimeUnit" => Enum.Parse(typeof(TimeUnit), value),
"TargetRecoveryTimeUnit" => Enum.Parse<TimeUnit>(value),
"QueryStoreStaleQueryThreshold" => int.Parse(value, CultureInfo.InvariantCulture),
"TargetRecoveryTimePeriod" => int.Parse(value, CultureInfo.InvariantCulture),
"ServiceBrokerOption" => Enum.Parse(typeof(ServiceBrokerOption), value),
"ServiceBrokerOption" => Enum.Parse<ServiceBrokerOption>(value),
"RecursiveTriggersOn" => bool.Parse(value),
"DelayedDurabilityMode" => Enum.Parse(typeof(DelayedDurabilityMode), value),
"RecoveryMode" => Enum.Parse(typeof(RecoveryMode), value),
"DelayedDurabilityMode" => Enum.Parse<DelayedDurabilityMode>(value),
"RecoveryMode" => Enum.Parse<RecoveryMode>(value),
"ReadOnly" => bool.Parse(value),
"SupplementalLoggingOn" => bool.Parse(value),
"DbScopedConfigParameterSniffing" => bool.Parse(value),
Expand All @@ -252,7 +252,7 @@ public void SetProperty(string key, string value)
"Collation" => value,
"AnsiNullsOn" => bool.Parse(value),
"AutoUpdateStatisticsAsync" => bool.Parse(value),
"CatalogCollation" => Enum.Parse(typeof(CatalogCollation), value),
"CatalogCollation" => Enum.Parse<CatalogCollation>(value),
"ChangeTrackingAutoCleanup" => bool.Parse(value),
"DbScopedConfigLegacyCardinalityEstimationSecondary" => bool.Parse(value),
"DbScopedConfigLegacyCardinalityEstimation" => bool.Parse(value),
Expand All @@ -263,13 +263,13 @@ public void SetProperty(string key, string value)
"DatabaseStateOffline" => bool.Parse(value),
"CursorDefaultGlobalScope" => bool.Parse(value),
"CursorCloseOnCommit" => bool.Parse(value),
"Containment" => Enum.Parse(typeof(Containment), value),
"Containment" => Enum.Parse<Containment>(value),
"ConcatNullYieldsNull" => bool.Parse(value),
"CompatibilityLevel" => int.Parse(value, CultureInfo.InvariantCulture),
"ChangeTrackingRetentionUnit" => Enum.Parse(typeof(TimeUnit), value),
"ChangeTrackingRetentionUnit" => Enum.Parse<TimeUnit>(value),
"ChangeTrackingRetentionPeriod" => int.Parse(value, CultureInfo.InvariantCulture),
"ChangeTrackingEnabled" => bool.Parse(value),
"UserAccessOption" => Enum.Parse(typeof(UserAccessOption), value),
"UserAccessOption" => Enum.Parse<UserAccessOption>(value),
"WithEncryption" => bool.Parse(value),
_ => throw new ArgumentException($"Unknown property with name {key}", nameof(key))
};
Expand Down

0 comments on commit 2ae97d2

Please sign in to comment.