Skip to content

Commit 527dee4

Browse files
committed
Renamed IKeyedTopicViewModel to ICoreTopicViewModel
With the introduction of `ContentType` (9bc0d00), the new name is more fitting. In addition, this is more consistent with our familiar phrasing of "core attributes" to refer to `Id`, `Key`, `ContentType`, and `Parent`. (Though we don't need `Id` or `Parent` here, as they're rarely needed in view models.)
1 parent 9bc0d00 commit 527dee4

4 files changed

Lines changed: 18 additions & 12 deletions

File tree

OnTopic.ViewModels/TopicViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace OnTopic.ViewModels {
2222
/// default implementations that can be used directly, used as base classes, or overwritten at the presentation level. They
2323
/// are supplied for convenience to model factory default settings for out-of-the-box content types.
2424
/// </remarks>
25-
public record TopicViewModel: ITopicViewModel, IKeyedTopicViewModel, IAssociatedTopicBindingModel, ITopicBindingModel {
25+
public record TopicViewModel: ITopicViewModel, ICoreTopicViewModel, IAssociatedTopicBindingModel, ITopicBindingModel {
2626

2727
/*==========================================================================================================================
2828
| ID
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,24 @@
1212
namespace OnTopic.Models {
1313

1414
/*============================================================================================================================
15-
| INTERFACE: KEYED TOPIC VIEW MODEL
15+
| INTERFACE: CORE TOPIC VIEW MODEL
1616
\---------------------------------------------------------------------------------------------------------------------------*/
1717
/// <summary>
18-
/// Ensures that a model maintains, at minimum, a <see cref="Key"/> property, necessary to support e.g. a <see cref="
19-
/// KeyedCollection{TKey, TValue}"/>.
18+
/// Ensures that a model maintains, at minimum, a <see cref="Key"/> and <see cref="ContentType"/> property, which are
19+
/// expected of all <see cref="Topic"/>s.
2020
/// </summary>
2121
/// <remarks>
22-
/// It is not required that topic view models implement the <see cref="IKeyedTopicViewModel"/> interface for the <see cref="
23-
/// TopicMappingService"/> to correctly identify and map <see cref="Topic"/>s to topic view models. That said, the interface
24-
/// does ensure that those view models can be keyed, which is useful for, especially, child collections.
22+
/// <para>
23+
/// This is necessary to support e.g. a <see cref="KeyedCollection{TKey, TValue}"/>, while also allowing it to filter by
24+
/// <see cref="ContentType"/>—a common requirement for topic (view model) collections.
25+
/// </para>
26+
/// <para>
27+
/// It is not required that topic view models implement the <see cref="ICoreTopicViewModel"/> interface for the <see cref=
28+
/// "TopicMappingService"/> to correctly identify and map <see cref="Topic"/>s to topic view models. That said, the
29+
/// interface does ensure that those view models can be keyed, which is useful for, especially, child collections.
30+
/// </para>
2531
/// </remarks>
26-
public interface IKeyedTopicViewModel {
32+
public interface ICoreTopicViewModel {
2733

2834
/*==========================================================================================================================
2935
| PROPERTY: KEY

OnTopic/Models/ITopicBindingModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace OnTopic.Models {
1717
/// It is strictly required that topic binding models implement the <see cref="ITopicBindingModel"/> interface for the
1818
/// default <see cref="ReverseTopicMappingService"/> to correctly identify and map a binding model to a <see cref="Topic"/>.
1919
/// </remarks>
20-
public interface ITopicBindingModel: IKeyedTopicViewModel {
20+
public interface ITopicBindingModel: ICoreTopicViewModel {
2121

2222

2323
} //Class

OnTopic/Models/ITopicViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace OnTopic.Models {
3030
/// layer and any supporting libraries.
3131
/// </para>
3232
/// </remarks>
33-
public interface ITopicViewModel: IKeyedTopicViewModel, IAssociatedTopicBindingModel, ITopicBindingModel {
33+
public interface ITopicViewModel: ICoreTopicViewModel, IAssociatedTopicBindingModel, ITopicBindingModel {
3434

3535
/*==========================================================================================================================
3636
| PROPERTY: ID
@@ -59,7 +59,7 @@ public interface ITopicViewModel: IKeyedTopicViewModel, IAssociatedTopicBindingM
5959
/// <remarks>
6060
/// This value can be set via the query string (via the <c>TopicViewResultExecutor</c> class), via the Accepts header
6161
/// (also via the <c>TopicViewResultExecutor</c> class), on the topic itself (via this property), or via the <see cref="
62-
/// IKeyedTopicViewModel.ContentType"/>. By default, it will be set to the name of the <see cref="IKeyedTopicViewModel.
62+
/// ICoreTopicViewModel.ContentType"/>. By default, it will be set to the name of the <see cref="ICoreTopicViewModel.
6363
/// ContentType"/>; e.g., if the Content Type is <c>Page</c>, then the view will be <c>Page</c>. This will cause the <c>
6464
/// TopicViewResultExecutor</c> to look for a view at, for instance, <c>/Views/Page/Page.cshtml</c>.
6565
/// </remarks>
@@ -81,7 +81,7 @@ public interface ITopicViewModel: IKeyedTopicViewModel, IAssociatedTopicBindingM
8181
/// Gets or sets the Title attribute, which represents the friendly name of the topic.
8282
/// </summary>
8383
/// <remarks>
84-
/// While the <see cref="IKeyedTopicViewModel.Key"/> may not contain, for instance, spaces or symbols, there are no
84+
/// While the <see cref="ICoreTopicViewModel.Key"/> may not contain, for instance, spaces or symbols, there are no
8585
/// restrictions on what characters can be used in the title. For this reason, it provides the default public value for
8686
/// referencing topics.
8787
/// </remarks>

0 commit comments

Comments
 (0)