@@ -190,7 +190,7 @@ private static void SetBlobAttributes(SqlDataReader reader, Dictionary<int, Topi
190190 /// Adds relationships retrieved from an individual relationship record to their associated topics.
191191 /// </summary>
192192 /// <remarks>
193- /// Topics can be cross-referenced with each other via a many-to-many relationships.Once the topics are populated in
193+ /// Topics can be cross-referenced with each other via a many-to-many relationships. Once the topics are populated in
194194 /// memory, loop through the data to create these associations.
195195 /// </remarks>
196196 /// <param name="reader">The <see cref="System.Data.SqlClient.SqlDataReader"/> that representing the current record.</param>
@@ -213,7 +213,7 @@ private static void SetRelationships(SqlDataReader reader, Dictionary<int, Topic
213213 | Identify affected topics
214214 \-----------------------------------------------------------------------------------------------------------------------*/
215215 var current = topics [ sourceTopicId ] ;
216- Topic related = null ;
216+ var related = ( Topic ) null ;
217217
218218 // Fetch the related topic
219219 if ( topics . Keys . Contains ( targetTopicId ) ) {
@@ -253,8 +253,8 @@ private static void SetDerivedTopics(Dictionary<int, Topic> topics) {
253253 | Loop through topics
254254 \-----------------------------------------------------------------------------------------------------------------------*/
255255 foreach ( var topic in topics . Values ) {
256- var success = Int32 . TryParse ( topic . Attributes . GetValue ( "TopicId" , "-1" , false , false ) , out var derivedTopicId ) ;
257- if ( ! success || derivedTopicId < 0 ) continue ;
256+ var derivedTopicId = topic . Attributes . GetInteger ( "TopicId" , - 1 , false , false ) ;
257+ if ( derivedTopicId < 0 ) continue ;
258258 if ( topics . Keys . Contains ( derivedTopicId ) ) {
259259 topic . DerivedTopic = topics [ derivedTopicId ] ;
260260 }
@@ -861,7 +861,7 @@ public override int Save(Topic topic, bool isRecursive = false, bool isDraft = f
861861 \-----------------------------------------------------------------------------------------------------------------------*/
862862 if ( isRecursive ) {
863863 foreach ( var childTopic in topic . Children ) {
864- Contract . Assume ( childTopic . Attributes . GetValue ( "ParentID" ) != null , "Assumes the Parent ID AttributeValue is available." ) ;
864+ Contract . Assume ( childTopic . Attributes . GetInteger ( "ParentID" , - 1 ) > 0 , "Assumes the Parent ID AttributeValue is available." ) ;
865865 childTopic . Attributes . SetValue ( "ParentID" , returnVal . ToString ( ) ) ;
866866 Save ( childTopic , isRecursive , isDraft ) ;
867867 }
0 commit comments