Skip to content

Commit a204766

Browse files
committed
Document. Abbreviate dispose pattern.
1 parent dd4d5e8 commit a204766

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

PSql/Commands/ConnectedCmdlet.cs

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// Copyright Subatomix Research Inc.
22
// SPDX-License-Identifier: MIT
33

4-
// Don't require doc comments. Commands are documented via a help file.
5-
#pragma warning disable CS1591
6-
74
namespace PSql.Commands;
85

96
/// <summary>
@@ -16,20 +13,26 @@ protected const string
1613
ContextName = nameof(Context);
1714

1815
/// <summary>
19-
/// <b>-Connection:</b> TODO
16+
/// <b>-Connection:</b>
17+
/// An open database connection. Obtain via <c>Connect-Sql</c>.
2018
/// </summary>
2119
[Parameter(ParameterSetName = ConnectionName, Mandatory = true)]
2220
public SqlConnection? Connection { get; set; }
2321

2422
/// <summary>
2523
/// <b>-Context:</b> TODO
24+
/// An object containing information necessary to connect to SQL Server,
25+
/// Azure SQL Database, or compatible database. Obtain via
26+
/// <c>New-SqlContext</c>.
2627
/// </summary>
2728
[Parameter(ParameterSetName = ContextName)]
2829
[ValidateNotNull]
2930
public SqlContext? Context { get; set; }
3031

3132
/// <summary>
32-
/// <b>-DatabaseName:</b> TODO
33+
/// <b>-DatabaseName:</b>
34+
/// An optional database name. If specified, this parameter overrides
35+
/// the database name, if any, specified in the <c>-Context</c>.
3336
/// </summary>
3437
[Alias("Database")]
3538
[Parameter(ParameterSetName = ContextName)]
@@ -57,21 +60,10 @@ protected override void BeginProcessing()
5760
}
5861
}
5962

60-
~ConnectedCmdlet()
61-
{
62-
Dispose(managed: false);
63-
}
64-
65-
void IDisposable.Dispose()
66-
{
67-
Dispose(managed: true);
68-
GC.SuppressFinalize(this);
69-
}
70-
71-
protected virtual void Dispose(bool managed)
63+
/// <inheritdoc/>
64+
public virtual void Dispose()
7265
{
73-
if (!managed)
74-
return;
66+
// No unmanaged resources to dispose; use abbreviated Dispose pattern
7567

7668
if (_ownsConnection)
7769
Connection?.Dispose();

0 commit comments

Comments
 (0)