Skip to content

Commit 7a27e31

Browse files
committed
Set default return code to @ReturnCode
By convention, all of OnTopic's stored procedures use `@ReturnCode` as the return code. As such, this can be assumed as the default when calling `AddOutputParameter()`.
1 parent 9b5d01e commit 7a27e31

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

OnTopic.Data.Sql/SqlCommandExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ internal static int GetReturnCode(this SqlCommand command, string sqlParameter =
4646
/// <param name="sqlParameter">The SQL parameter.</param>
4747
/// <param name="paramDirection">The SQL parameter's directional setting (input-only, output-only, etc.).</param>
4848
/// <param name="sqlDbType">The SQL field data type.</param>
49-
internal static void AddOutputParameter(this SqlCommand command, string sqlParameter) =>
49+
internal static void AddOutputParameter(this SqlCommand command, string sqlParameter = "ReturnCode") =>
5050
AddParameter(command, sqlParameter, null, SqlDbType.Int, ParameterDirection.ReturnValue);
5151

5252
/*==========================================================================================================================

OnTopic.Data.Sql/SqlTopicRepository.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ public override Topic Load(string? topicKey = null, bool isRecursive = true) {
339339
| Establish query parameters
340340
\---------------------------------------------------------------------------------------------------------------------*/
341341
command.AddParameter("TopicKey", topicKey);
342-
command.AddOutputParameter("ReturnCode");
342+
command.AddOutputParameter();
343343

344344
/*----------------------------------------------------------------------------------------------------------------------
345345
| Populate topics
@@ -763,7 +763,7 @@ public override int Save([NotNull]Topic topic, bool isRecursive = false, bool is
763763
command.AddParameter("DeleteRelationships", true);
764764
}
765765
command.AddParameter("ExtendedAttributes", extendedAttributes);
766-
command.AddOutputParameter("ReturnCode");
766+
command.AddOutputParameter();
767767

768768
/*----------------------------------------------------------------------------------------------------------------------
769769
| Execute query

0 commit comments

Comments
 (0)