Skip to content

Commit c23d443

Browse files
committed
Remove C# 6 operators
1 parent 6e409a5 commit c23d443

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

src/ResourceManager/Websites/Commands.Websites/Cmdlets/DeploymentSlots/NewAzureWebAppSlot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected override void ProcessRecord()
7272
CloneCustomHostNames = !IgnoreCustomHostNames.IsPresent,
7373
CloneSourceControl = !IgnoreSourceControl.IsPresent,
7474
ConfigureLoadBalancing = false,
75-
AppSettingsOverrides = AppSettingsOverrides?.Cast<DictionaryEntry>().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString(), StringComparer.Ordinal)
75+
AppSettingsOverrides = AppSettingsOverrides == null ? null : AppSettingsOverrides.Cast<DictionaryEntry>().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString(), StringComparer.Ordinal)
7676
};
7777
}
7878

src/ResourceManager/Websites/Commands.Websites/Cmdlets/DeploymentSlots/SetAzureWebAppSlot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ protected override void ProcessRecord()
132132
siteConfig = WebApp.SiteConfig;
133133

134134
// Update web app configuration
135-
WebsitesClient.UpdateWebAppConfiguration(ResourceGroupName, location, Name, Slot, siteConfig, WebApp.SiteConfig?.AppSettings.ToDictionary(nvp => nvp.Name, nvp => nvp.Value, StringComparer.OrdinalIgnoreCase), WebApp.SiteConfig?.ConnectionStrings.ToDictionary(nvp => nvp.Name, nvp => new ConnStringValueTypePair { Type = nvp.Type, Value = nvp.ConnectionString }, StringComparer.OrdinalIgnoreCase));
135+
WebsitesClient.UpdateWebAppConfiguration(ResourceGroupName, location, Name, Slot, siteConfig, WebApp.SiteConfig == null ? null : WebApp.SiteConfig.AppSettings.ToDictionary(nvp => nvp.Name, nvp => nvp.Value, StringComparer.OrdinalIgnoreCase), WebApp.SiteConfig == null ? null : WebApp.SiteConfig.ConnectionStrings.ToDictionary(nvp => nvp.Name, nvp => new ConnStringValueTypePair { Type = nvp.Type, Value = nvp.ConnectionString }, StringComparer.OrdinalIgnoreCase));
136136

137137
CmdletHelpers.TryParseAppServicePlanMetadataFromResourceId(WebApp.ServerFarmId, out rg, out servicePlanName);
138138
WebsitesClient.UpdateWebApp(ResourceGroupName, location, Name, Slot, servicePlanName);

src/ResourceManager/Websites/Commands.Websites/Cmdlets/WebApps/NewAzureWebApp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected override void ProcessRecord()
8585
TrafficManagerProfileId = TrafficManagerProfileId,
8686
TrafficManagerProfileName = TrafficManagerProfileName,
8787
ConfigureLoadBalancing = !string.IsNullOrEmpty(TrafficManagerProfileId) || !string.IsNullOrEmpty(TrafficManagerProfileName),
88-
AppSettingsOverrides = AppSettingsOverrides?.Cast<DictionaryEntry>().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString(), StringComparer.Ordinal)
88+
AppSettingsOverrides = AppSettingsOverrides == null ? null: AppSettingsOverrides.Cast<DictionaryEntry>().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString(), StringComparer.Ordinal)
8989
};
9090
}
9191

src/ResourceManager/Websites/Commands.Websites/Cmdlets/WebApps/SetAzureWebApp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ protected override void ProcessRecord()
146146
siteConfig = WebApp.SiteConfig;
147147

148148
// Update web app configuration
149-
WebsitesClient.UpdateWebAppConfiguration(ResourceGroupName, location, Name, null, siteConfig, WebApp.SiteConfig?.AppSettings.ToDictionary(nvp => nvp.Name, nvp => nvp.Value, StringComparer.OrdinalIgnoreCase), WebApp.SiteConfig?.ConnectionStrings.ToDictionary(nvp => nvp.Name, nvp => new ConnStringValueTypePair { Type = nvp.Type, Value = nvp.ConnectionString }, StringComparer.OrdinalIgnoreCase));
149+
WebsitesClient.UpdateWebAppConfiguration(ResourceGroupName, location, Name, null, siteConfig, WebApp.SiteConfig == null ? null : WebApp.SiteConfig.AppSettings.ToDictionary(nvp => nvp.Name, nvp => nvp.Value, StringComparer.OrdinalIgnoreCase), WebApp.SiteConfig == null ? null : WebApp.SiteConfig.ConnectionStrings.ToDictionary(nvp => nvp.Name, nvp => new ConnStringValueTypePair { Type = nvp.Type, Value = nvp.ConnectionString }, StringComparer.OrdinalIgnoreCase));
150150

151151
CmdletHelpers.TryParseAppServicePlanMetadataFromResourceId(WebApp.ServerFarmId, out rg, out servicePlanName);
152152
WebsitesClient.UpdateWebApp(ResourceGroupName, location, Name, null, servicePlanName);

src/ResourceManager/Websites/Commands.Websites/Utilities/CmdletHelpers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ public static class CmdletHelpers
3838

3939
public static Dictionary<string, string> ConvertToStringDictionary(this Hashtable hashtable)
4040
{
41-
return hashtable?.Cast<DictionaryEntry>()
41+
return hashtable == null ? null : hashtable.Cast<DictionaryEntry>()
4242
.ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString(), StringComparer.Ordinal);
4343
}
4444

4545
public static Dictionary<string, ConnStringValueTypePair> ConvertToConnectionStringDictionary(this Hashtable hashtable)
4646
{
47-
return hashtable?.Cast<DictionaryEntry>()
47+
return hashtable == null ? null : hashtable.Cast<DictionaryEntry>()
4848
.ToDictionary(
4949
kvp => kvp.Key.ToString(), kvp =>
5050
{

src/ResourceManager/Websites/Commands.Websites/Utilities/WebsitesClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ public string ResetWebAppPublishingCredentials(string resourceGroupName, string
251251

252252
var publishingXml = (CmdletHelpers.ShouldUseDeploymentSlot(webSiteName, slotName, out qualifiedSiteName) ? WrappedWebsitesClient.Sites.ListSitePublishingProfileXmlSlot(resourceGroupName, webSiteName, options, slotName) : WrappedWebsitesClient.Sites.ListSitePublishingProfileXml(resourceGroupName, webSiteName, options));
253253
var doc = XDocument.Load(publishingXml, LoadOptions.None);
254-
var profile = doc.Root?.Element("publishData")?.Elements("publishProfile")
254+
var profile = doc.Root == null ? null : doc.Root.Element("publishData") == null ? null : doc.Root.Element("publishData").Elements("publishProfile")
255255
.Single(p => p.Attribute("publishMethod").Value == "MSDeploy");
256-
return profile?.Attribute("userPWD").Value;
256+
return profile == null ? null: profile.Attribute("userPWD").Value;
257257
}
258258

259259
public IList<ResourceMetric> GetWebAppUsageMetrics(string resourceGroupName, string webSiteName, string slotName, IReadOnlyList<string> metricNames,

0 commit comments

Comments
 (0)