Skip to content

Commit 5058cd7

Browse files
fix: Add missing XML doc comments and replace obsolete WebClient with HttpClient
Add XML summary comments to all public members of RegisterDbaMaintenanceTaskCommand. Replace obsolete System.Net.WebClient with System.Net.Http.HttpClient in ConfigurationHelpers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8ec4686 commit 5058cd7

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

project/dbatools/Commands/RunspaceCmdlets.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,24 +201,43 @@ protected override void ProcessRecord()
201201
[Cmdlet("Register", "DbaMaintenanceTask", DefaultParameterSetName = "Repeating")]
202202
public class RegisterDbaMaintenanceTaskCommand : DbaBaseCmdlet
203203
{
204+
/// <summary>
205+
/// Name of the maintenance task to register.
206+
/// </summary>
204207
[Parameter(Mandatory = true)]
205208
public string Name { get; set; }
206209

210+
/// <summary>
211+
/// The scriptblock to execute as the maintenance task.
212+
/// </summary>
207213
[Parameter(Mandatory = true)]
208214
public ScriptBlock ScriptBlock { get; set; }
209215

216+
/// <summary>
217+
/// Whether to execute the task only once.
218+
/// </summary>
210219
[Parameter(ParameterSetName = "Once", Mandatory = true)]
211220
public SwitchParameter Once { get; set; }
212221

222+
/// <summary>
223+
/// Interval between repeated executions of the task.
224+
/// </summary>
213225
[Parameter(ParameterSetName = "Repeating", Mandatory = true)]
214226
public TimeSpan Interval { get; set; }
215227

228+
/// <summary>
229+
/// Initial delay before first execution.
230+
/// </summary>
216231
[Parameter()]
217232
public TimeSpan Delay { get; set; }
218233

234+
/// <summary>
235+
/// Priority of the maintenance task.
236+
/// </summary>
219237
[Parameter()]
220238
public MaintenancePriority Priority { get; set; } = MaintenancePriority.Medium;
221239

240+
/// <inheritdoc />
222241
protected override void ProcessRecord()
223242
{
224243
string normalizedName = Name.ToLowerInvariant();

project/dbatools/Internal/ConfigurationHelpers.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Collections.Generic;
55
using System.IO;
66
using System.Management.Automation;
7-
using System.Net;
7+
using System.Net.Http;
88
using System.Text;
99

1010
namespace Dataplat.Dbatools.Internal
@@ -56,10 +56,9 @@ public static List<Hashtable> ReadConfigFromUrl(PSCmdlet cmdlet, string url)
5656
if (String.IsNullOrEmpty(url))
5757
return new List<Hashtable>();
5858

59-
using (WebClient client = new WebClient())
59+
using (HttpClient client = new HttpClient())
6060
{
61-
client.Encoding = Encoding.UTF8;
62-
string jsonContent = client.DownloadString(url);
61+
string jsonContent = client.GetStringAsync(url).GetAwaiter().GetResult();
6362
return ParseConfigJson(cmdlet, jsonContent);
6463
}
6564
}

0 commit comments

Comments
 (0)