diff --git a/.editorconfig b/.editorconfig index 9d682c96..21393d23 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/src/DacpacTool/PackageBuilder.cs b/src/DacpacTool/PackageBuilder.cs index 43c2e913..a812c86c 100644 --- a/src/DacpacTool/PackageBuilder.cs +++ b/src/DacpacTool/PackageBuilder.cs @@ -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(value), + "QueryStoreCaptureMode" => Enum.Parse(value), + "ParameterizationOption" => Enum.Parse(value), + "PageVerifyMode" => Enum.Parse(value), "QueryStoreMaxStorageSize" => int.Parse(value, CultureInfo.InvariantCulture), "NumericRoundAbortOn" => bool.Parse(value), "NestedTriggersOn" => bool.Parse(value), @@ -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(value), "DbScopedConfigParameterSniffingSecondary" => bool.Parse(value), "QueryStoreMaxPlansPerQuery" => int.Parse(value, CultureInfo.InvariantCulture), "QuotedIdentifierOn" => bool.Parse(value), @@ -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(value), "QueryStoreStaleQueryThreshold" => int.Parse(value, CultureInfo.InvariantCulture), "TargetRecoveryTimePeriod" => int.Parse(value, CultureInfo.InvariantCulture), - "ServiceBrokerOption" => Enum.Parse(typeof(ServiceBrokerOption), value), + "ServiceBrokerOption" => Enum.Parse(value), "RecursiveTriggersOn" => bool.Parse(value), - "DelayedDurabilityMode" => Enum.Parse(typeof(DelayedDurabilityMode), value), - "RecoveryMode" => Enum.Parse(typeof(RecoveryMode), value), + "DelayedDurabilityMode" => Enum.Parse(value), + "RecoveryMode" => Enum.Parse(value), "ReadOnly" => bool.Parse(value), "SupplementalLoggingOn" => bool.Parse(value), "DbScopedConfigParameterSniffing" => bool.Parse(value), @@ -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(value), "ChangeTrackingAutoCleanup" => bool.Parse(value), "DbScopedConfigLegacyCardinalityEstimationSecondary" => bool.Parse(value), "DbScopedConfigLegacyCardinalityEstimation" => bool.Parse(value), @@ -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(value), "ConcatNullYieldsNull" => bool.Parse(value), "CompatibilityLevel" => int.Parse(value, CultureInfo.InvariantCulture), - "ChangeTrackingRetentionUnit" => Enum.Parse(typeof(TimeUnit), value), + "ChangeTrackingRetentionUnit" => Enum.Parse(value), "ChangeTrackingRetentionPeriod" => int.Parse(value, CultureInfo.InvariantCulture), "ChangeTrackingEnabled" => bool.Parse(value), - "UserAccessOption" => Enum.Parse(typeof(UserAccessOption), value), + "UserAccessOption" => Enum.Parse(value), "WithEncryption" => bool.Parse(value), _ => throw new ArgumentException($"Unknown property with name {key}", nameof(key)) };