Skip to content

Commit 13b1114

Browse files
committed
Merge branch 'maintenance/obsolete-messages' into develop
As part of the development of OnTopic 5.0.0, quite a few types, members, and parameters have been renamed, removed, or modified in a way that breaks backward compatibility (#27). To help aid in the migration, these types, members, and overloads have been reintroduced with `[Obsolete]` messages so that callers will receive migration instructions when calling the obsolete items. As a matter of housekeeping, `[Obsolete]` types have been moved to the `/Obsolete` folder so they're not confused with current types, or cluttering the production code—though the original namespaces obviously have been retained. These will likely be removed in OnTopic 5.1.0 or 5.2.0, once we have confidence that most implementations have been migrated to OnTopic 5.x.
2 parents f7fb979 + 348a4d1 commit 13b1114

24 files changed

Lines changed: 1535 additions & 11 deletions

OnTopic/Attributes/AttributeRecord.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ public AttributeRecord(
9393
/// <para>
9494
/// How an attribute is stored in the underlying repository doesn't impact how the attribute is treated as part of the
9595
/// object model. By tracking this, however, OnTopic is able to evaluate configuration mismatches during <see
96-
/// cref="ITopicRepository.Save"/>. This allows the <see cref="ITopicRepository"/> to effective handle scenarios where
97-
/// the configuration for an <see cref="AttributeDescriptor"/> has changed prior to the last time a <see cref="Topic"/>
98-
/// was saved, and thus change the location where it is stored.
96+
/// cref="ITopicRepository.Save(Topic, Boolean)"/>. This allows the <see cref="ITopicRepository"/> to effective handle
97+
/// scenarios where the configuration for an <see cref="AttributeDescriptor"/> has changed prior to the last time a <see
98+
/// cref="Topic"/> was saved, and thus change the location where it is stored.
9999
/// </para>
100100
/// <para>
101101
/// This is important because, otherwise, <see cref="ITopicRepository"/> implementations rely primarily on <see

OnTopic/Collections/ReadOnlyKeyedTopicCollection{T}.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ public class ReadOnlyKeyedTopicCollection<T> : ReadOnlyCollection<T> where T : T
3535
_innerCollection = innerCollection as KeyedTopicCollection<T>?? new(innerCollection);
3636
}
3737

38+
/*==========================================================================================================================
39+
| FACTORY METHOD: FROM LIST
40+
\-------------------------------------------------------------------------------------------------------------------------*/
41+
/// <summary>
42+
/// Establishes a new <see cref="ReadOnlyTopicCollection{T}"/> based on an existing <see cref="List{T}"/>.
43+
/// </summary>
44+
/// <remarks>
45+
/// The <paramref name="innerCollection"/> will be converted to a <see cref="TopicCollection{T}"/>.
46+
/// </remarks>
47+
/// <param name="innerCollection">The underlying <see cref="TopicCollection{T}"/>.</param>
48+
[Obsolete("This is effectively satisfied by the related overload, and has been removed.", true)]
49+
public ReadOnlyTopicCollection<T> FromList(IList<T> innerCollection) => throw new NotImplementedException();
50+
3851
/*==========================================================================================================================
3952
| METHOD: GET VALUE
4053
\-------------------------------------------------------------------------------------------------------------------------*/

OnTopic/Collections/ReadOnlyTopicCollection.cs

Lines changed: 34 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
using System.Collections.Generic;
78
using System.Collections.ObjectModel;
89

@@ -26,5 +27,38 @@ public class ReadOnlyTopicCollection : ReadOnlyCollection<Topic> {
2627
public ReadOnlyTopicCollection(IList<Topic>? innerCollection = null) : base(innerCollection?? new List<Topic>()) {
2728
}
2829

30+
/*==========================================================================================================================
31+
| FACTORY METHOD: FROM LIST
32+
\-------------------------------------------------------------------------------------------------------------------------*/
33+
/// <summary>
34+
/// Establishes a new <see cref="ReadOnlyTopicCollection"/> based on an existing <see cref="List{Topic}"/>.
35+
/// </summary>
36+
/// <remarks>
37+
/// The <paramref name="innerCollection"/> will be converted to a <see cref="ReadOnlyTopicCollection"/>.
38+
/// </remarks>
39+
/// <param name="innerCollection">The underlying <see cref="List{Topic}"/>.</param>
40+
[Obsolete("This is effectively satisfied by the related overload, and has been removed.", true)]
41+
public ReadOnlyTopicCollection FromList(IList<Topic> innerCollection) => throw new NotImplementedException();
42+
43+
/*==========================================================================================================================
44+
| METHOD: GET TOPIC
45+
\-------------------------------------------------------------------------------------------------------------------------*/
46+
/// <inheritdoc cref="ReadOnlyKeyedTopicCollection{T}.GetTopic(String)"/>
47+
[Obsolete(
48+
"The GetTopic() method is not implemented on ReadOnlyTopicCollection. Use ReadOnlyKeyedTopicCollection instead.",
49+
true
50+
)]
51+
public Topic? GetValue(string key) => throw new NotImplementedException();
52+
53+
/*==========================================================================================================================
54+
| INDEXER
55+
\-------------------------------------------------------------------------------------------------------------------------*/
56+
/// <inheritdoc cref="ReadOnlyKeyedTopicCollection{T}"/>
57+
[Obsolete(
58+
"Indexing by key is not implemented on ReadOnlyTopicCollection. Use ReadOnlyKeyedTopicCollection instead.",
59+
true
60+
)]
61+
public Topic this[string key] => throw new ArgumentOutOfRangeException(nameof(key));
62+
2963
} //Class
3064
} //Namespace

OnTopic/Collections/TopicCollection.cs

Lines changed: 15 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
using System.Collections.Generic;
78
using System.Collections.ObjectModel;
89
using System.Linq;
@@ -35,5 +36,19 @@ public class TopicCollection : Collection<Topic> {
3536
/// </summary>
3637
public ReadOnlyTopicCollection AsReadOnly() => new(this);
3738

39+
/*==========================================================================================================================
40+
| METHOD: GET TOPIC
41+
\-------------------------------------------------------------------------------------------------------------------------*/
42+
/// <inheritdoc cref="KeyedTopicCollection{T}.GetTopic(String)"/>
43+
[Obsolete("The GetTopic() method is not implemented on TopicCollection. Use KeyedTopicCollection instead.", true)]
44+
public Topic? GetValue(string key) => throw new NotImplementedException();
45+
46+
/*==========================================================================================================================
47+
| INDEXER
48+
\-------------------------------------------------------------------------------------------------------------------------*/
49+
/// <inheritdoc cref="KeyedTopicCollection{T}"/>
50+
[Obsolete("Indexing by key is not implemented on the TopicCollection. Use the KeyedTopicCollection instead.",true)]
51+
public Topic this[string key] => throw new ArgumentOutOfRangeException(nameof(key));
52+
3853
} //Class
3954
} //Namespace

OnTopic/Lookup/StaticTypeLookupService.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,33 @@ public StaticTypeLookupService(
5353

5454
}
5555

56+
/// <summary>
57+
/// Establishes a new instance of a <see cref="StaticTypeLookupService"/>. Optionally accepts a list of <see cref="Type"/>
58+
/// instances and a default <see cref="Type"/> value.
59+
/// </summary>
60+
/// <remarks>
61+
/// Any <see cref="Type"/> instances submitted via <paramref name="types"/> should be unique by <see
62+
/// cref="MemberInfo.Name"/>; if they are not, they will be removed.
63+
/// </remarks>
64+
/// <param name="types">The list of <see cref="Type"/> instances to expose as part of this service.</param>
65+
/// <param name="defaultType">The default type to return if no match can be found. Defaults to object.</param>
66+
[Obsolete("The DefaultType property has been removed. Fallbacks types can now be added to Lookup() directly.", true)]
67+
public StaticTypeLookupService(
68+
IEnumerable<Type>? types,
69+
Type? defaultType
70+
) {
71+
throw new NotImplementedException();
72+
}
73+
74+
/*==========================================================================================================================
75+
| PROPERTY: DEFAULT TYPE
76+
\-------------------------------------------------------------------------------------------------------------------------*/
77+
/// <summary>
78+
/// The default type to return in case <see cref="Lookup(String[])"/> cannot find a match.
79+
/// </summary>
80+
[Obsolete("The DefaultType property has been removed. Fallbacks types can now be added to Lookup() directly.", true)]
81+
public Type? DefaultType { get; }
82+
5683
/*==========================================================================================================================
5784
| METHOD: LOOKUP
5885
\-------------------------------------------------------------------------------------------------------------------------*/

OnTopic/Mapping/Annotations/AttributeKeyAttribute.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,21 @@ public AttributeKeyAttribute(string key) {
3737
}
3838

3939
/*==========================================================================================================================
40-
| PROPERTY: Key
40+
| PROPERTY: KEY
4141
\-------------------------------------------------------------------------------------------------------------------------*/
4242
/// <summary>
4343
/// Gets the value of the attribute key.
4444
/// </summary>
4545
public string Key { get; }
4646

47+
/*==========================================================================================================================
48+
| PROPERTY: VALUE
49+
\-------------------------------------------------------------------------------------------------------------------------*/
50+
/// <summary>
51+
/// Gets the value of the attribute key.
52+
/// </summary>
53+
[Obsolete("The Value property has been renamed to Key for consistency", true)]
54+
public string? Value { get; }
55+
4756
} //Class
4857
} //Namespace

0 commit comments

Comments
 (0)