Skip to content

Commit 7bea7d3

Browse files
committed
Removed legacy CreateRelationshipsXml() support
In a previous version of OnTopic, presumably, there was a need to build an XML document out of the relationships, presumably so that they could optionally be stored as part of the XML blob. This hasn't been used for a while, however, and only adds clutter and unnecessary complexity to an already bloated class. Cancelled!
1 parent 2f02641 commit 7bea7d3

1 file changed

Lines changed: 6 additions & 53 deletions

File tree

OnTopic.Data.Sql/SqlTopicRepository.cs

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ List<Topic> unresolvedRelationships
465465
);
466466

467467
if (areReferencesResolved && areRelationshipsDirty) {
468-
PersistRelations(topic, connection, true);
468+
PersistRelations(topic, connection);
469469
}
470470

471471
topic.VersionHistory.Insert(0, version.Value);
@@ -640,21 +640,14 @@ public override void Delete(Topic topic, bool isRecursive = false) {
640640
/// </summary>
641641
/// <param name="topic">The topic object whose relationships should be persisted.</param>
642642
/// <param name="connection">The SQL connection.</param>
643-
/// <param name="skipXml">
644-
/// Boolean indicator noting whether attributes saved in the XML should be skipped as part of the operation.
645-
/// </param>
646-
/// <returns>
647-
/// An XML-formatted string representing the <see cref="Topic.Relationships"/> XML content, or a blank string if
648-
/// <c>skipXml == true</c>.
649-
/// </returns>
650-
private static string PersistRelations(Topic topic, SqlConnection connection, bool skipXml) {
643+
private static void PersistRelations(Topic topic, SqlConnection connection) {
651644

652645
/*------------------------------------------------------------------------------------------------------------------------
653646
| Return blank if the topic has no relations.
654647
\-----------------------------------------------------------------------------------------------------------------------*/
655-
// return "" if the topic has no relations
648+
// return if the topic has no relations
656649
if (!topic.Relationships.Keys.Any()) {
657-
return "";
650+
return;
658651
}
659652
var command = (SqlCommand?)null;
660653

@@ -713,51 +706,11 @@ private static string PersistRelations(Topic topic, SqlConnection connection, bo
713706
}
714707

715708
/*------------------------------------------------------------------------------------------------------------------------
716-
| Return the relationship attributes to append to the XML attributes (unless skipXml is set to true)
709+
| Return
717710
\-----------------------------------------------------------------------------------------------------------------------*/
718-
return skipXml? "" : CreateRelationshipsXml(topic);
711+
return;
719712

720713
}
721714

722-
/*==========================================================================================================================
723-
| METHOD: CREATE RELATIONSHIPS XML
724-
\-------------------------------------------------------------------------------------------------------------------------*/
725-
/// <summary>
726-
/// Internal helper function to build string of related XML nodes for each scope of related items in model.
727-
/// </summary>
728-
/// <param name="topic">The topic object for which to create the relationships.</param>
729-
/// <returns>The XML string.</returns>
730-
private static string CreateRelationshipsXml(Topic topic) {
731-
732-
/*------------------------------------------------------------------------------------------------------------------------
733-
| Create XML string container
734-
\-----------------------------------------------------------------------------------------------------------------------*/
735-
var attributesXml = new StringBuilder("");
736-
737-
/*------------------------------------------------------------------------------------------------------------------------
738-
| Add a related XML node for each scope
739-
\-----------------------------------------------------------------------------------------------------------------------*/
740-
foreach (var key in topic.Relationships.Keys) {
741-
742-
var scope = topic.Relationships.GetTopics(key);
743-
744-
attributesXml.Append("<related scope=\"");
745-
attributesXml.Append(key);
746-
attributesXml.Append("\">");
747-
748-
// Build out string array of related items in this scope
749-
var targetIds = new string[scope.Count];
750-
var count = 0;
751-
foreach (var relTopic in scope) {
752-
targetIds[count] = relTopic.Id.ToString(CultureInfo.InvariantCulture);
753-
count++;
754-
}
755-
attributesXml.Append(String.Join(",", targetIds));
756-
attributesXml.Append("</related>");
757-
}
758-
759-
return attributesXml.ToString();
760-
}
761-
762715
} //Class
763716
} //Namespace

0 commit comments

Comments
 (0)