Skip to content

Commit 9bc0d00

Browse files
committed
Moved ContentType to IKeyedTopicViewModel
This will allow e.g. `TopicViewModelCollection<T>` to filter by content type, which is a common feature of topic (view model) collections.
1 parent bfa64f1 commit 9bc0d00

3 files changed

Lines changed: 15 additions & 16 deletions

File tree

OnTopic/Models/IKeyedTopicViewModel.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.ComponentModel.DataAnnotations;
88
using System.Diagnostics.CodeAnalysis;
99
using OnTopic.Mapping;
10+
using OnTopic.Metadata;
1011

1112
namespace OnTopic.Models {
1213

@@ -36,5 +37,18 @@ public interface IKeyedTopicViewModel {
3637
[Required, NotNull, DisallowNull]
3738
string? Key { get; init; }
3839

40+
/*==========================================================================================================================
41+
| PROPERTY: CONTENT TYPE
42+
\-------------------------------------------------------------------------------------------------------------------------*/
43+
/// <summary>
44+
/// Gets the key name of the content type that the current topic represents.
45+
/// </summary>
46+
/// <remarks>
47+
/// Each topic is associated with a content type. The content type determines which attributes are displayed in the Topics
48+
/// Editor (via the <see cref="ContentTypeDescriptor.AttributeDescriptors"/> property).
49+
/// </remarks>
50+
[Required, NotNull, DisallowNull]
51+
string? ContentType { get; init; }
52+
3953
} //Class
4054
} //Namespace

OnTopic/Models/ITopicBindingModel.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6-
using System.ComponentModel.DataAnnotations;
7-
using System.Diagnostics.CodeAnalysis;
86
using OnTopic.Mapping.Reverse;
9-
using OnTopic.Metadata;
107

118
namespace OnTopic.Models {
129

@@ -22,18 +19,6 @@ namespace OnTopic.Models {
2219
/// </remarks>
2320
public interface ITopicBindingModel: IKeyedTopicViewModel {
2421

25-
/*==========================================================================================================================
26-
| PROPERTY: CONTENT TYPE
27-
\-------------------------------------------------------------------------------------------------------------------------*/
28-
/// <summary>
29-
/// Gets the key name of the content type that the current topic represents.
30-
/// </summary>
31-
/// <remarks>
32-
/// Each topic is associated with a content type. The content type determines which attributes are displayed in the Topics
33-
/// Editor (via the <see cref="ContentTypeDescriptor.AttributeDescriptors"/> property).
34-
/// </remarks>
35-
[Required, NotNull, DisallowNull]
36-
string? ContentType { get; init; }
3722

3823
} //Class
3924
} //Namespace

OnTopic/Models/ITopicViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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-
/// ITopicBindingModel.ContentType"/>. By default, it will be set to the name of the <see cref="ITopicBindingModel.
62+
/// IKeyedTopicViewModel.ContentType"/>. By default, it will be set to the name of the <see cref="IKeyedTopicViewModel.
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>

0 commit comments

Comments
 (0)