Skip to content

Commit 306e5c7

Browse files
committed
Added XMLDoc documentation for NavigationViewModel<T>
The purpose of these properties may not be immediately clear—and especially in terms of how they relate to `INavigationTopicViewModel<T>`—so adding documentation helps clarify the relationships in the fairly complex landscope of the navigation view components. This also ensures IntelliSense support.
1 parent e8dd4d1 commit 306e5c7

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

OnTopic.AspNetCore.Mvc/Models/NavigationViewModel{T}.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,40 @@ namespace OnTopic.AspNetCore.Mvc.Models {
2727
/// </remarks>
2828
public class NavigationViewModel<T> where T : class, INavigationTopicViewModel<T> {
2929

30+
/*==========================================================================================================================
31+
| NAVIGATION ROOT
32+
\-------------------------------------------------------------------------------------------------------------------------*/
33+
/// <summary>
34+
/// Represents the root element in the navigation.
35+
/// </summary>
36+
/// <remarks>
37+
/// Since this implements <see cref="IHierarchicalTopicViewModel{T}"/>, it may include multiple levels of children. By
38+
/// implementing it as a generic, each site or application can provide its own <see cref="INavigationTopicViewModel{T}"/>
39+
/// implementation, thus potentially extending the schema with properties relevant to that site's navigation. For example,
40+
/// a site may optionally add an <c>IconUrl</c> property if it wishes to assign unique icons to each link in the
41+
/// navigation.
42+
/// </remarks>
3043
public T? NavigationRoot { get; set; }
44+
45+
/*==========================================================================================================================
46+
| CURRENT KEY
47+
\-------------------------------------------------------------------------------------------------------------------------*/
48+
/// <summary>
49+
/// The <see cref="Topic.GetUniqueKey()"/> representing the path to the current <see cref="Topic"/>.
50+
/// </summary>
51+
/// <remarks>
52+
/// <para>
53+
/// In order to determine whether any given <see cref="INavigationTopicViewModel{T}.IsSelected(string)"/>, the views
54+
/// will need to know where in the hierarchy the user currently is. By storing this on the <see
55+
/// cref="NavigationViewModel{T}"/> used as the root view model for every navigation component, we ensure that the views
56+
/// always have access to this information.
57+
/// </para>
58+
/// <para>
59+
/// It's worth noting that while this <i>could</i> be stored on the <see cref="INavigationTopicViewModel{T}"/> itself,
60+
/// that would prevent those values from being cached. As such, it's preferrable to keep the navigation nodes stateless,
61+
/// and maintaining state exclusively in the <see cref="NavigationViewModel{T}"/> itself.
62+
/// </para>
63+
/// </remarks>
3164
public string CurrentKey { get; set; } = default!;
3265

3366
} //Class

0 commit comments

Comments
 (0)