Skip to content

Commit b49ce5e

Browse files
committed
Merge branch 'refactoring/deprecation-warnings' into develop
2 parents 90c83d4 + 3cd7465 commit b49ce5e

File tree

14 files changed

+38
-30
lines changed

14 files changed

+38
-30
lines changed

OnTopic.AspNetCore.Mvc.Host/Program.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
namespace OnTopic.AspNetCore.Mvc.Host {
1111

12-
1312
/*============================================================================================================================
1413
| CLASS: PROGRAM
1514
\---------------------------------------------------------------------------------------------------------------------------*/

OnTopic.AspNetCore.Mvc/Controllers/SitemapController.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
using System;
77
using System.Collections.Generic;
88
using System.Globalization;
9-
using System.IO;
109
using System.Linq;
11-
using System.Text;
1210
using System.Xml;
1311
using System.Xml.Linq;
12+
using Microsoft.AspNetCore.Mvc;
1413
using OnTopic.Internal.Diagnostics;
1514
using OnTopic.Repositories;
16-
using Microsoft.AspNetCore.Mvc;
15+
16+
#pragma warning disable CS0618 // Type or member is obsolete; supresses known issue with helper methods being moved to private
1717

1818
namespace OnTopic.AspNetCore.Mvc.Controllers {
1919

@@ -126,6 +126,7 @@ public virtual ActionResult Index(bool indent = false) {
126126
/// Given a root topic, generates an XML-formatted sitemap.
127127
/// </summary>
128128
/// <returns>The site's homepage view.</returns>
129+
[Obsolete("The GenerateSitemap() method should not be public. It will be marked private in OnTopic Library 5.0.")]
129130
public virtual XDocument GenerateSitemap(Topic rootTopic) =>
130131
new XDocument(
131132
new XElement(_sitemapNamespace + "urlset",
@@ -140,6 +141,7 @@ select AddTopic(topic)
140141
/// <summary>
141142
/// Given a <see cref="Topic"/>, adds it to a given <see cref="XmlNode"/>.
142143
/// </summary>
144+
[Obsolete("The AddTopic() method should not be public. It will be marked private in OnTopic Library 5.0.")]
143145
public IEnumerable<XElement> AddTopic(Topic topic) {
144146

145147
/*------------------------------------------------------------------------------------------------------------------------
@@ -217,4 +219,6 @@ from relatedTopic in topic.Relationships[relationship.Name]
217219
}
218220

219221
} //Class
220-
} //Namespace
222+
} //Namespace
223+
224+
#pragma warning restore CS0618 // Type or member is obsolete

OnTopic.AspNetCore.Mvc/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static IRouteBuilder MapTopicRoute(
8383
/// Adds an MVC route for handling OnTopic related requests, and maps it to the <see cref="TopicController"/> by default.
8484
/// </summary>
8585
/// <remarks>
86-
/// This is functionally identical to <see cref="MapTopicRoute(IRouteBuilder, string, string, string)"/>, except that it
86+
/// This is functionally identical to <see cref="MapTopicRoute(IRouteBuilder, String, String, String)"/>, except that it
8787
/// targets the <see cref="IEndpointRouteBuilder"/>, which is preferred in ASP.NET Core 3.
8888
/// </remarks>
8989
public static ControllerActionEndpointConventionBuilder MapTopicRoute(

OnTopic.AspNetCore.Mvc/TopicRepositoryExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ RouteData routeData
6363
| case particular routes aren't present. That said, if they are defined, but should be excluded from a fallback, then
6464
| that path does need to be defined—thus e.g. {area}/{controller}/{path}.
6565
\-----------------------------------------------------------------------------------------------------------------------*/
66-
var paths = new List<String?>() {
66+
var paths = new List<string?>() {
6767
cleanPath($"{rootTopic}/{path}"),
6868
cleanPath($"{area}/{controller}/{action}/{path}"),
6969
cleanPath($"{area}/{controller}/{path}"),

OnTopic.Data.Caching/CachedTopicRepository.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ public CachedTopicRepository(ITopicRepository dataProvider) : base() {
183183
/*------------------------------------------------------------------------------------------------------------------------
184184
| Define variables
185185
\-----------------------------------------------------------------------------------------------------------------------*/
186-
var remainder = uniqueKey.Substring(sourceTopic.GetUniqueKey().Length + 1);
187-
var marker = remainder.IndexOf(":", StringComparison.Ordinal);
188-
var nextChild = (marker < 0) ? remainder : remainder.Substring(0, marker);
186+
var remainder = uniqueKey.Substring(sourceTopic.GetUniqueKey().Length + 1);
187+
var marker = remainder.IndexOf(":", StringComparison.Ordinal);
188+
var nextChild = (marker < 0) ? remainder : remainder.Substring(0, marker);
189189

190190
/*------------------------------------------------------------------------------------------------------------------------
191191
| Find topic

OnTopic.Tests/ReverseTopicMappingServiceTest.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ public async Task Map_Existing_ReturnsUpdatedTopic() {
140140
target.DefaultValue = "Hello";
141141
target.IsRequired = true;
142142
target.IsExtendedAttribute= false;
143-
target.Description = "Original Description";
143+
144+
target.Attributes.SetValue("Description", "Original Description");
144145

145146
target = (TextAttribute?)await mappingService.MapAsync(bindingModel, target).ConfigureAwait(false);
146147

@@ -150,7 +151,7 @@ public async Task Map_Existing_ReturnsUpdatedTopic() {
150151
Assert.AreEqual<string>("World", target.DefaultValue);
151152
Assert.AreEqual<bool>(false, target.IsRequired);
152153
Assert.AreEqual<bool>(false, target.IsExtendedAttribute);
153-
Assert.AreEqual<string>("Original Description", target.Description);
154+
Assert.AreEqual<string>("Original Description", target.Attributes.GetValue("Description"));
154155

155156
}
156157

@@ -173,7 +174,7 @@ public async Task Map_ComplexObject_ReturnsFlattenedTopic() {
173174
bindingModel.PrimaryContact.Name = "Jeremy";
174175
bindingModel.AlternateContact.Email = "AlternateContact@Ignia.com";
175176
bindingModel.BillingContact.Email = "BillingContact@Ignia.com";
176-
177+
177178
var target = (Topic?)await mappingService.MapAsync(bindingModel).ConfigureAwait(false);
178179

179180
Assert.IsNotNull(target);

OnTopic.ViewModels/ContentItemTopicViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6-
76
using System;
87

98
namespace OnTopic.ViewModels {

OnTopic/ITopicRoutingService.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6+
using System;
67

78
namespace OnTopic {
89

@@ -17,6 +18,11 @@ namespace OnTopic {
1718
/// adapter to framework-specific libraries (e.g., <code>HttpContext</code>). In addition, custom versions may be created
1819
/// in order to establish custom mappings between URL or route data and the hierarchy of topics, should the need arise.
1920
/// </remarks>
21+
[Obsolete(
22+
"The ITopicRoutingService is no longer used in the latest clients, and will be removed in OnTopic Library 5.0. In the " +
23+
"latest OnTopic.AspNetCore.Mvc libraries, it is replaced with a ITopicRepository.Load() extension method which accepts " +
24+
"RouteData as an argument, in order to lookup topics based on that library's routing conventions."
25+
)]
2026
public interface ITopicRoutingService {
2127

2228
/*==========================================================================================================================

OnTopic/Repositories/DeleteEventArgs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace OnTopic.Repositories {
1313
/// <summary>
1414
/// The DeleteEventArgs class defines an event argument type specific to deletion events
1515
/// </summary>
16+
[Obsolete("The TopicRepository events will be removed in OnTopic Library 5.0.", false)]
1617
public class DeleteEventArgs : EventArgs {
1718

1819
/*==========================================================================================================================

OnTopic/Repositories/ITopicRepository.cs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,19 @@ public interface ITopicRepository {
2222
/// <summary>
2323
/// Instantiates the <see cref="DeleteEventArgs"/> event handler.
2424
/// </summary>
25+
[Obsolete("The TopicRepository events will be removed in OnTopic Library 5.0.", false)]
2526
event EventHandler<DeleteEventArgs> DeleteEvent;
2627

2728
/// <summary>
2829
/// Instantiates the <see cref="MoveEventArgs"/> event handler.
2930
/// </summary>
31+
[Obsolete("The TopicRepository events will be removed in OnTopic Library 5.0.", false)]
3032
event EventHandler<MoveEventArgs> MoveEvent;
3133

3234
/// <summary>
3335
/// Instantiates the <see cref="RenameEventArgs"/> event handler.
3436
/// </summary>
37+
[Obsolete("The TopicRepository events will be removed in OnTopic Library 5.0.", false)]
3538
event EventHandler<RenameEventArgs> RenameEvent;
3639

3740
/*==========================================================================================================================
@@ -74,21 +77,6 @@ public interface ITopicRepository {
7477
/// <returns>A topic object.</returns>
7578
Topic? Load(int topicId, DateTime version);
7679

77-
/*==========================================================================================================================
78-
| ###TODO JJC080314: An overload to Load() should be created to accept an XmlDocument or XmlNode based on the proposed
79-
| Import/Export schema.
80-
>---------------------------------------------------------------------------------------------------------------------------
81-
| ###NOTE JJC080313: If the topic already exists, return the existing node, by calling its Merge() function. Otherwise,
82-
| construct a new node using its XmlNode constructor.
83-
>---------------------------------------------------------------------------------------------------------------------------
84-
public static Topic Load(XmlNode node, ImportStrategy importStrategy = ImportStrategy.Merge) {
85-
//Process XML
86-
//Construct children objects
87-
//###NOTE JJC080314: May need to cross-reference with Load() and/or TopicRepository to validate against whatever objects
88-
//are already created and available.
89-
}
90-
\-------------------------------------------------------------------------------------------------------------------------*/
91-
9280
/*==========================================================================================================================
9381
| METHOD: ROLLBACK
9482
\-------------------------------------------------------------------------------------------------------------------------*/

OnTopic/Repositories/MoveEventArgs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace OnTopic.Repositories {
1717
/// <remarks>
1818
/// Allows tracking of the source and destination topics.
1919
/// </remarks>
20+
[Obsolete("The TopicRepository events will be removed in OnTopic Library 5.0.", false)]
2021
public class MoveEventArgs : EventArgs {
2122

2223
/*==========================================================================================================================

OnTopic/Repositories/RenameEventArgs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace OnTopic.Repositories {
1313
/// <summary>
1414
/// The RenameEventArgs object defines an event argument type specific to rename events.
1515
/// </summary>
16+
[Obsolete("The TopicRepository events will be removed in OnTopic Library 5.0.", false)]
1617
public class RenameEventArgs : EventArgs {
1718

1819
/*==========================================================================================================================

OnTopic/Repositories/TopicRepositoryBase.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
using System.Linq;
1616
using OnTopic.Collections;
1717

18+
#pragma warning disable CS0618 // Type or member is obsolete; used to hide known deprecation of events until v5.0.0
19+
1820
namespace OnTopic.Repositories {
1921

2022
/*============================================================================================================================
@@ -34,12 +36,15 @@ public abstract class TopicRepositoryBase : ITopicRepository {
3436
| EVENT HANDLERS
3537
\-------------------------------------------------------------------------------------------------------------------------*/
3638
/// <inheritdoc />
39+
[Obsolete("The TopicRepository events will be removed in OnTopic Library 5.0.", false)]
3740
public event EventHandler<DeleteEventArgs>? DeleteEvent;
3841

3942
/// <inheritdoc />
43+
[Obsolete("The TopicRepository events will be removed in OnTopic Library 5.0.", false)]
4044
public event EventHandler<MoveEventArgs>? MoveEvent;
4145

4246
/// <inheritdoc />
47+
[Obsolete("The TopicRepository events will be removed in OnTopic Library 5.0.", false)]
4348
public event EventHandler<RenameEventArgs>? RenameEvent;
4449

4550
/*==========================================================================================================================
@@ -434,4 +439,6 @@ protected IEnumerable<AttributeDescriptor> GetUnmatchedAttributes(Topic topic) {
434439
}
435440

436441
} //Class
437-
} //Namespace
442+
} //Namespace
443+
444+
#pragma warning restore CS0618 // Type or member is obsolete

OnTopic/Topic.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ public string Title {
368368
/// <requires description="The value from the getter must be provided." exception="T:System.ArgumentNullException">
369369
/// !string.IsNullOrWhiteSpace(value)
370370
/// </requires>
371+
[Obsolete("The Description convenience property will be removed in OnTopic Library 5.0. Use Attributes.SetValue() instead.")]
371372
public string? Description {
372373
get => Attributes.GetValue("Description");
373374
set => SetAttributeValue("Description", value);

0 commit comments

Comments
 (0)