Skip to content

Commit 8ad42b9

Browse files
committed
Applied IAssociatedTopicBindingModel to ITopicViewModel
Since `UniqueKey` is defined on both `ITopicBindingModel` and `IAssociatedTopicBindingModel`, and there's no other "pollution" from any otherwise unnecessary interface requirements on `IAssociatedTopicBindingModel`, we can derive `ITopicBindingModel` from `IAssociatedTopicBindingModel`, thus allowing them to share this definition, while also allowing implementations to satisfy both interfaces. This can also be applied to `TopicViewModel`.
1 parent 5ea98c9 commit 8ad42b9

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

OnTopic.ViewModels/TopicViewModel.cs

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

2525
/*==========================================================================================================================
2626
| ID

OnTopic/Models/ITopicViewModel.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace OnTopic.Models {
2828
/// presentation layer and any supporting libraries.
2929
/// </para>
3030
/// </remarks>
31-
public interface ITopicViewModel: IKeyedTopicViewModel {
31+
public interface ITopicViewModel: IKeyedTopicViewModel, IAssociatedTopicBindingModel {
3232

3333
/*==========================================================================================================================
3434
| PROPERTY: ID
@@ -38,20 +38,12 @@ public interface ITopicViewModel: IKeyedTopicViewModel {
3838
/// </summary>
3939
int Id { get; init; }
4040

41-
/*==========================================================================================================================
42-
| PROPERTY: UNIQUE KEY
43-
\-------------------------------------------------------------------------------------------------------------------------*/
44-
/// <summary>
45-
/// Gets or sets the topic's <see cref="UniqueKey"/> attribute, the unique text identifier for the topic.
46-
/// </summary>
47-
string? UniqueKey { get; init; }
48-
4941
/*==========================================================================================================================
5042
| PROPERTY: WEB PATH
5143
\-------------------------------------------------------------------------------------------------------------------------*/
5244
/// <summary>
53-
/// Gets or sets the topic's <see cref="WebPath"/> attribute, which represents the <see cref="UniqueKey"/> in its URL
54-
/// format.
45+
/// Gets or sets the topic's <see cref="WebPath"/> attribute, which represents the <see cref="IAssociatedTopicBindingModel
46+
/// .UniqueKey"/> in its URL format.
5547
/// </summary>
5648
string? WebPath { get; init; }
5749

0 commit comments

Comments
 (0)