Skip to content

Commit df949aa

Browse files
committed
Document.
1 parent a204766 commit df949aa

7 files changed

Lines changed: 111 additions & 61 deletions

PSql/Commands/ConnectSqlCommand.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
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>
107
/// The <c>Connect-Sql</c> command.
8+
/// Opens a connection to SQL Server, Azure SQL Database, or compatible
9+
/// database.
1110
/// </summary>
1211
[Cmdlet(VerbsCommunications.Connect, "Sql")]
1312
[OutputType(typeof(SqlConnection))]
1413
public class ConnectSqlCommand : PSqlCmdlet
1514
{
1615
/// <summary>
17-
/// <b>-Context:</b> TODO
16+
/// <b>-Context:</b>
17+
/// An object containing information necessary to connect to SQL Server,
18+
/// Azure SQL Database, or compatible database. Obtain via
19+
/// <c>New-SqlContext</c>.
1820
/// </summary>
1921
[Parameter(Position = 0, ValueFromPipeline = true)]
2022
public SqlContext? Context { get; set; }
2123

2224
/// <summary>
23-
/// <b>-DatabaseName:</b> TODO
25+
/// <b>-DatabaseName:</b>
26+
/// An optional database name. If specified, this parameter overrides
27+
/// the database name, if any, specified in the <c>-Context</c>.
2428
/// </summary>
2529
[Parameter]
2630
[Alias("Database")]
2731
public string? DatabaseName { get; set; }
2832

33+
/// <inheritdoc/>
2934
protected override void ProcessRecord()
3035
{
3136
var context = Context ?? new();

PSql/Commands/ConnectedCmdlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected const string
2020
public SqlConnection? Connection { get; set; }
2121

2222
/// <summary>
23-
/// <b>-Context:</b> TODO
23+
/// <b>-Context:</b>
2424
/// An object containing information necessary to connect to SQL Server,
2525
/// Azure SQL Database, or compatible database. Obtain via
2626
/// <c>New-SqlContext</c>.

PSql/Commands/DisconnectSqlCommand.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
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>
107
/// The <c>Disconnect-Sql</c> command.
8+
/// Closes a connection created by <c>Connect-Sql</c>.
119
/// </summary>
1210
[Cmdlet(VerbsCommunications.Disconnect, "Sql")]
1311
[OutputType(typeof(void))]
1412
public class DisconnectSqlCommand : PSqlCmdlet
1513
{
1614
/// <summary>
17-
/// <b>-Connection:</b> TODO
15+
/// <b>-Connection:</b>
16+
/// An open database connection. Obtain via <c>Connect-Sql</c>.
1817
/// </summary>
1918
[Parameter(Position = 0, ValueFromPipeline = true, ValueFromRemainingArguments = true)]
2019
public SqlConnection[]? Connection { get; set; }
2120

21+
/// <inheritdoc/>
2222
protected override void ProcessRecord()
2323
{
2424
if (Connection is { } connections)

PSql/Commands/ExpandSqlCmdDirectivesCommand.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,31 @@ namespace PSql.Commands;
77

88
/// <summary>
99
/// The <c>Expand-SqlCmdDirectives</c> command.
10+
/// Performs limited SQLCMD-style preprocessing.
1011
/// </summary>
1112
[Cmdlet(VerbsData.Expand, "SqlCmdDirectives")]
1213
[OutputType(typeof(string[]))]
1314
public class ExpandSqlCmdDirectivesCommand : PSqlCmdlet
1415
{
1516
/// <summary>
16-
/// <b>-Sql:</b> TODO
17+
/// <b>-Sql:</b>
18+
/// SQL scripts(s) to process.
1719
/// </summary>
1820
[Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true)]
1921
public string?[]? Sql { get; set; }
2022

2123
/// <summary>
22-
/// <b>-Define:</b> TODO
24+
/// <b>-Define:</b>
25+
/// SQLCMD preprocessor variables to define.
2326
/// </summary>
2427
[Parameter(Position = 1)]
2528
public Hashtable? Define { get; set; }
2629

2730
private readonly E.SqlCmdPreprocessor _preprocessor;
2831

2932
/// <summary>
30-
/// Creates a new <see cref="ExpandSqlCmdDirectivesCommand"/> instance.
33+
/// Initializes a new <see cref="ExpandSqlCmdDirectivesCommand"/>
34+
/// instance.
3135
/// </summary>
3236
public ExpandSqlCmdDirectivesCommand()
3337
{

PSql/Commands/InvokeSqlCommand.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,58 @@
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
using System.Collections;
85

96
namespace PSql.Commands;
107

118
/// <summary>
129
/// The <c>Invoke-Sql</c> command.
10+
/// Runs SQL scripts on SQL Server, Azure SQL Database, or compatible
11+
/// systems.
1312
/// </summary>
1413
[Cmdlet(VerbsLifecycle.Invoke, "Sql", DefaultParameterSetName = ContextName)]
1514
[OutputType(typeof(PSObject[]))]
1615
public class InvokeSqlCommand : ConnectedCmdlet
1716
{
1817
/// <summary>
19-
/// <b>-Sql:</b> TODO
18+
/// <b>-Sql:</b>
19+
/// SQL scripts(s) to run.
2020
/// </summary>
2121
[Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true)]
2222
public string?[]? Sql { get; set; }
2323

2424
/// <summary>
25-
/// <b>-Define:</b> TODO
25+
/// <b>-Define:</b>
26+
/// SQLCMD preprocessor variables to define.
2627
/// </summary>
2728
[Parameter(Position = 1)]
2829
public Hashtable? Define { get; set; }
2930

3031
/// <summary>
31-
/// <b>-NoPreprocessing:</b> TODO
32+
/// <b>-NoPreprocessing:</b>
33+
/// Disables SQLCMD preprocessing support.
3234
/// </summary>
3335
[Parameter]
3436
[Alias("NoSqlCmdMode")]
3537
public SwitchParameter NoPreprocessing { get; set; }
3638

3739
/// <summary>
38-
/// <b>-NoErrorHandling:</b> TODO
40+
/// <b>-NoErrorHandling:</b>
41+
/// Disables the error-handling wrapper.
3942
/// </summary>
4043
[Parameter]
4144
public SwitchParameter NoErrorHandling { get; set; }
4245

4346
/// <summary>
44-
/// <b>-UseSqlTypes:</b> TODO
47+
/// <b>-UseSqlTypes:</b>
48+
/// Reads column values using native SQL Server types instead of .NET types.
4549
/// </summary>
4650
[Parameter]
4751
public SwitchParameter UseSqlTypes { get; set; }
4852

4953
/// <summary>
50-
/// <b>-Timeout:</b> TODO
54+
/// <b>-Timeout:</b>
55+
/// Maximum duration to wait for each SQL batch to complete.
5156
/// </summary>
5257
[Parameter]
5358
public TimeSpan? Timeout { get; set; }

PSql/Commands/NewSqlContextCommand.cs

Lines changed: 45 additions & 22 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
using static ApplicationIntent;
@@ -12,6 +9,8 @@ namespace PSql.Commands;
129

1310
/// <summary>
1411
/// The <c>New-SqlContext</c> command.
12+
/// Creates an object specifying how to connect to SQL Server, Azure SQL
13+
/// Database, or compatible system.
1514
/// </summary>
1615
[Cmdlet(VerbsCommon.New, nameof(SqlContext), DefaultParameterSetName = GenericName)]
1716
[OutputType(typeof(SqlContext))]
@@ -23,20 +22,24 @@ private const string
2322
CloneName = "Clone";
2423

2524
/// <summary>
26-
/// <b>-Azure:</b> TODO
25+
/// <b>-Azure:</b>
26+
/// Specifies that the context connects to Azure SQL Database.
2727
/// </summary>
2828
[Parameter(ParameterSetName = AzureName, Mandatory = true)]
2929
public SwitchParameter Azure { get; set; }
3030

3131
/// <summary>
32-
/// <b>-Source:</b> TODO
32+
/// <b>-Source:</b>
33+
/// A context previously created by this cmdlet from which to copy
34+
/// property values into the created context.
3335
/// </summary>
3436
[Parameter(ParameterSetName = CloneName, Mandatory = true, ValueFromPipeline = true)]
3537
[ValidateNotNull]
3638
public SqlContext? Source { get; set; }
3739

3840
/// <summary>
39-
/// <b>-ResourceGroupName:</b> TODO
41+
/// <b>-ResourceGroupName:</b>
42+
/// Name of the Azure resource group containing the database server.
4043
/// </summary>
4144
[Alias("ResourceGroup", "ServerResourceGroupName")]
4245
[Parameter(ParameterSetName = AzureName, Position = 0)]
@@ -45,7 +48,8 @@ private const string
4548
public string? ResourceGroupName { get; set; }
4649

4750
/// <summary>
48-
/// <b>-ServerResourceName:</b> TODO
51+
/// <b>-ServerResourceName:</b>
52+
/// Azure resource name of the database server.
4953
/// </summary>
5054
[Alias("Resource")]
5155
[Parameter(ParameterSetName = AzureName, Position = 1)]
@@ -54,7 +58,8 @@ private const string
5458
public string? ServerResourceName { get; set; }
5559

5660
/// <summary>
57-
/// <b>-ServerName:</b> TODO
61+
/// <b>-ServerName:</b>
62+
/// DNS name of the database server.
5863
/// </summary>
5964
[Alias("Server")]
6065
[Parameter(ParameterSetName = GenericName, Position = 0)]
@@ -64,7 +69,8 @@ private const string
6469
public string? ServerName { get; set; }
6570

6671
/// <summary>
67-
/// <b>-DatabaseName:</b> TODO
72+
/// <b>-DatabaseName:</b>
73+
/// Name of the database.
6874
/// </summary>
6975
[Alias("Database")]
7076
[Parameter(ParameterSetName = GenericName, Position = 1)]
@@ -74,31 +80,35 @@ private const string
7480
public string? DatabaseName { get; set; }
7581

7682
/// <summary>
77-
/// <b>-AuthenticationMode:</b> TODO
83+
/// <b>-AuthenticationMode:</b>
84+
/// Method to use to authenticate with Azure SQL Database.
7885
/// </summary>
7986
[Alias("Auth")]
8087
[Parameter(ParameterSetName = AzureName)]
8188
[Parameter(ParameterSetName = CloneName)]
8289
public AzureAuthenticationMode AuthenticationMode { get; set; }
8390

8491
/// <summary>
85-
/// <b>-Credential:</b> TODO
92+
/// <b>-Credential:</b>
93+
/// Credential to use to authenticate with the database server.
8694
/// </summary>
8795
[Parameter]
8896
[Credential]
8997
[AllowNull]
9098
public PSCredential? Credential { get; set; } = PSCredential.Empty;
9199

92100
/// <summary>
93-
/// <b>-EncryptionMode:</b> TODO
101+
/// <b>-EncryptionMode:</b>
102+
/// Transport encryption to use for connections.
94103
/// </summary>
95104
[Alias("Encryption")]
96105
[Parameter(ParameterSetName = GenericName)]
97106
[Parameter(ParameterSetName = CloneName)]
98107
public EncryptionMode EncryptionMode { get; set; }
99108

100109
/// <summary>
101-
/// <b>-ServerPort:</b> TODO
110+
/// <b>-ServerPort:</b>
111+
/// Remote TCP port of the database server.
102112
/// </summary>
103113
[Alias("Port")]
104114
[Parameter(ParameterSetName = GenericName)]
@@ -107,7 +117,8 @@ private const string
107117
public ushort? ServerPort { get; set; }
108118

109119
/// <summary>
110-
/// <b>-InstanceName:</b> TODO
120+
/// <b>-InstanceName:</b>
121+
/// Name of the database engine instance.
111122
/// </summary>
112123
[Alias("Instance")]
113124
[Parameter(ParameterSetName = GenericName)]
@@ -116,61 +127,73 @@ private const string
116127
public string? InstanceName { get; set; }
117128

118129
/// <summary>
119-
/// <b>-ReadOnlyIntent:</b> TODO
130+
/// <b>-ReadOnlyIntent:</b>
131+
/// Specifies that the client intends to perform only reads.
120132
/// </summary>
121133
[Alias("ReadOnly")]
122134
[Parameter]
123135
public SwitchParameter ReadOnlyIntent { get; set; }
124136

125137
/// <summary>
126-
/// <b>-ClientName:</b> TODO
138+
/// <b>-ClientName:</b>
139+
/// Name of the client device.
127140
/// </summary>
128141
[Alias("Client")]
129142
[Parameter]
130143
[AllowNull, AllowEmptyString]
131144
public string? ClientName { get; set; }
132145

133146
/// <summary>
134-
/// <b>-ApplicationName:</b> TODO
147+
/// <b>-ApplicationName:</b>
148+
/// Name of the client application.
135149
/// </summary>
136150
[Alias("Application")]
137151
[Parameter]
138152
[AllowNull, AllowEmptyString]
139153
public string? ApplicationName { get; set; }
140154

141155
/// <summary>
142-
/// <b>-ConnectTimeout:</b> TODO
156+
/// <b>-ConnectTimeout:</b>
157+
/// Duration after which a connection attempt times out.
143158
/// </summary>
144159
[Alias("Timeout")]
145160
[Parameter]
146161
[ValidateNullOrTimeout]
147162
public TimeSpan? ConnectTimeout { get; set; }
148163

149164
/// <summary>
150-
/// <b>-ExposeCredentialInConnectionString:</b> TODO
165+
/// <b>-ExposeCredentialInConnectionString:</b>
166+
/// Specifies that the credential used for authentication should be
167+
/// exposed in connections' ConnectionString property.
151168
/// </summary>
152169
[Parameter]
153170
public SwitchParameter ExposeCredentialInConnectionString { get; set; }
154171

155172
/// <summary>
156-
/// <b>-Pooling:</b> TODO
173+
/// <b>-Pooling:</b>
174+
/// Specifies that connections may be pooled to reduce setup and teardown
175+
/// time.
157176
/// </summary>
158177
[Parameter]
159178
public SwitchParameter Pooling { get; set; }
160179

161180
/// <summary>
162-
/// <b>-MultipleActiveResultSets:</b> TODO
181+
/// <b>-MultipleActiveResultSets:</b>
182+
/// Specifies that connections support execution of multiple batches
183+
/// concurrently, with limitations.
163184
/// </summary>
164185
[Alias("Mars")]
165186
[Parameter]
166187
public SwitchParameter MultipleActiveResultSets { get; set; }
167188

168189
/// <summary>
169-
/// <b>-Frozen:</b> TODO
190+
/// <b>-Frozen:</b>
191+
/// Specifies that the created context should be frozen.
170192
/// </summary>
171193
[Parameter]
172194
public SwitchParameter Frozen { get; set; }
173195

196+
/// <inheritdoc/>
174197
protected override void ProcessRecord()
175198
{
176199
var context = Source?.Clone() ?? CreateContext();

0 commit comments

Comments
 (0)