Skip to content

Commit 371f279

Browse files
committed
Merge branch 'release/4.5.0' into master
This update focuses primarily on minor feature improvements, such as new extension methods for `Topic` (7d08ac6) and `AttributeValueCollection` (9795dd1), as well as new utility functions in the SQL schema (1e9b1d5), such as `GetUniqueKey()` (a2ac659) and `GetTopicIDByUniqueKey()` (ea97f91). It also includes a number of bug fixes as well as some cleanup. Most notably, it fixes a bug where existing attributes values cannot be reset to empty under certain circumstances—notably include those involving the OnTopic Editor (1e4812f). Features and Improvements - Added `MarkClean()` methods to `AttributeValueCollection` to improve the semantics for `IsDirty` tracking and to better account for deleted attributes (1e4812f) - Added `FindAll()` (4dbf872), `FindFirstParent()` (aa54ccf), and `GetContentTypeDescriptor()` (026e7a3) extension methods for `Topic` (7d08ac6) - Added `GetDouble()` (148a1b1) and `SetDouble()` (23f9ce2) extension methods to `AttributeValueCollection` (9795dd1) - Added `GetChildTopicIDs()` (8e0eca5) and `FindTopicIDs()` (1dfd333) functions in order to facilitate tree traversal and lookups in SQL - Added `GetUniqueKey()` (a2ac659), `GetTopicIDByUniqueKey()` (ea97f91), and `GetExtendedAttribute()` (28a4694) functions, as well as a `UniqueKeyIndex` view (b09ca5d) to the SQL database schema (1e9b1d5) - Added and implemented (68492d2) the `AddOrReplace()` (cd92791) and `TryAdd()` (027ae25) methods to the `StaticTypeLookupService` to simplify inheritance (6687431) - Significant updates to `GenerateNestedSet` to support transactions and topic ordering, while eliminating the need for `Topics.RangeRight` to allow `NULL` (c6b50f3) Bug Fixes - Fixed a bug where a deleted attribute might not get saved since deleted attributes didn't result in the `AttributeValueCollection` being marked as `IsDirty()` (1e4812f) - Updated `GetAttributes()` stored procedure as a function (aa040ef) to return the latest version of both indexed and extended attributes (05ae378) - Used UTC time for `@Version` parameter when updating the database via `SqlTopicRepository.Save()` to avoid time mismatches between computers (d85743d) - Updated `RelatedTopicCollection.RemoveTopic()` to remove reciprocal `IncomingRelationships` in order to avoid stale content or orphaned references (4514244) - Improved validation for `TopicRepositoryBase.Delete()` (67b70ca), including checks for `isRecursive` mismatches (29c904a) and orphaned `DerivedTopic`s (58057e1), as well as handling of orphaned relationships (13e4fe9, 2550779) Cleanup - Cleanup of SQL objects (c997b0e), including moving `UniqueKeyIndex` (4a17205), `LeftRightRange` (e565f0e), and `Hierarchy` (now `AdjacencyList`) to the `Utilities` schema (17b98b4), and removal of legacy `SimpleIntListToTbl` and `Split` functions (f0e781b). - Applied updates based on new code analysis warnings (b00cfad) Potentially Breaking Changes - Moving, renaming, and deleting of utility objects in SQL database schema (c997b0e) - Setting default for `ITopicRepositoryBase.Delete()`'s `isRecursive` parameter from `false` to `true` to maintain backward compatibility (1773113) Note: These aren't expected to break any actual implementations. In particular, utility objects are not referenced from the products, and most weren't previously documented, so it's not expected that they would have been integrated with or called from third-party implementations. Similarly, while the change to `ITopicRepositoryBase.Delete()` changes the default, it does so to _avoid_ a behavioral change.
2 parents 466158c + 9b87fc5 commit 371f279

File tree

87 files changed

+1844
-414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1844
-414
lines changed

OnTopic.AspNetCore.Mvc.Host/Components/MenuViewComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6+
using Microsoft.AspNetCore.Mvc;
67
using OnTopic.AspNetCore.Mvc.Components;
78
using OnTopic.AspNetCore.Mvc.Models;
89
using OnTopic.Mapping.Hierarchical;
910
using OnTopic.Repositories;
1011
using OnTopic.ViewModels;
11-
using Microsoft.AspNetCore.Mvc;
1212

1313
namespace OnTopic.AspNetCore.Mvc.Host.Components {
1414

OnTopic.AspNetCore.Mvc.Host/Components/PageLevelNavigationViewComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6+
using Microsoft.AspNetCore.Mvc;
67
using OnTopic.AspNetCore.Mvc.Components;
78
using OnTopic.AspNetCore.Mvc.Models;
89
using OnTopic.Mapping.Hierarchical;
910
using OnTopic.Repositories;
1011
using OnTopic.ViewModels;
11-
using Microsoft.AspNetCore.Mvc;
1212

1313
namespace OnTopic.AspNetCore.Mvc.Host.Components {
1414

OnTopic.AspNetCore.Mvc.Host/SampleActivator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
| Project Sample OnTopic Site
55
\=============================================================================================================================*/
66
using System;
7+
using Microsoft.AspNetCore.Mvc;
8+
using Microsoft.AspNetCore.Mvc.Controllers;
9+
using Microsoft.AspNetCore.Mvc.ViewComponents;
710
using OnTopic.AspNetCore.Mvc.Controllers;
811
using OnTopic.AspNetCore.Mvc.Host.Components;
912
using OnTopic.Data.Caching;
@@ -13,9 +16,6 @@
1316
using OnTopic.Reflection;
1417
using OnTopic.Repositories;
1518
using OnTopic.ViewModels;
16-
using Microsoft.AspNetCore.Mvc;
17-
using Microsoft.AspNetCore.Mvc.Controllers;
18-
using Microsoft.AspNetCore.Mvc.ViewComponents;
1919

2020
namespace OnTopic.AspNetCore.Mvc.Host {
2121

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
@using OnTopic.AspNetCore.Mvc.Host
2-
@using OnTopic.AspNetCore.Mvc.Host.Components
3-
@using OnTopic;
4-
@using OnTopic.ViewModels
5-
@using OnTopic.AspNetCore.Mvc.Models
1+
@using System.Web
62
@using Microsoft.AspNetCore.Html
73
@using Microsoft.AspNetCore.Mvc.Razor
8-
@using System.Web
4+
@using OnTopic;
95
@using OnTopic.AspNetCore.Mvc.Components
6+
@using OnTopic.AspNetCore.Mvc.Host
7+
@using OnTopic.AspNetCore.Mvc.Host.Components
8+
@using OnTopic.AspNetCore.Mvc.Models
9+
@using OnTopic.ViewModels
1010

1111
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
1212
@addTagHelper *, OnTopic.AspNetCore.Mvc.Host

OnTopic.AspNetCore.Mvc.Tests/TopicControllerTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
\=============================================================================================================================*/
66
using System;
77
using System.Threading.Tasks;
8+
using Microsoft.AspNetCore.Http;
9+
using Microsoft.AspNetCore.Mvc;
10+
using Microsoft.AspNetCore.Mvc.Controllers;
11+
using Microsoft.AspNetCore.Routing;
12+
using Microsoft.VisualStudio.TestTools.UnitTesting;
813
using OnTopic.AspNetCore.Mvc;
914
using OnTopic.AspNetCore.Mvc.Controllers;
1015
using OnTopic.Data.Caching;
1116
using OnTopic.Mapping;
1217
using OnTopic.Repositories;
1318
using OnTopic.TestDoubles;
1419
using OnTopic.ViewModels;
15-
using Microsoft.AspNetCore.Http;
16-
using Microsoft.AspNetCore.Mvc;
17-
using Microsoft.AspNetCore.Mvc.Controllers;
18-
using Microsoft.AspNetCore.Routing;
19-
using Microsoft.VisualStudio.TestTools.UnitTesting;
2020

2121
namespace OnTopic.Tests {
2222

OnTopic.AspNetCore.Mvc.Tests/TopicRepositoryExtensionsTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6+
using Microsoft.AspNetCore.Routing;
7+
using Microsoft.VisualStudio.TestTools.UnitTesting;
68
using OnTopic.AspNetCore.Mvc;
79
using OnTopic.Data.Caching;
810
using OnTopic.Repositories;
911
using OnTopic.TestDoubles;
10-
using Microsoft.AspNetCore.Routing;
11-
using Microsoft.VisualStudio.TestTools.UnitTesting;
1212

1313
namespace OnTopic.Tests {
1414

OnTopic.AspNetCore.Mvc.Tests/TopicViewComponentTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
\=============================================================================================================================*/
66
using System.Linq;
77
using System.Threading.Tasks;
8+
using Microsoft.AspNetCore.Http;
9+
using Microsoft.AspNetCore.Mvc.Rendering;
10+
using Microsoft.AspNetCore.Mvc.ViewComponents;
11+
using Microsoft.AspNetCore.Routing;
12+
using Microsoft.VisualStudio.TestTools.UnitTesting;
813
using OnTopic.AspNetCore.Mvc.Host.Components;
914
using OnTopic.AspNetCore.Mvc.Models;
1015
using OnTopic.Data.Caching;
@@ -13,11 +18,6 @@
1318
using OnTopic.Repositories;
1419
using OnTopic.TestDoubles;
1520
using OnTopic.ViewModels;
16-
using Microsoft.AspNetCore.Http;
17-
using Microsoft.AspNetCore.Mvc.Rendering;
18-
using Microsoft.AspNetCore.Mvc.ViewComponents;
19-
using Microsoft.AspNetCore.Routing;
20-
using Microsoft.VisualStudio.TestTools.UnitTesting;
2121

2222
namespace OnTopic.Tests {
2323

OnTopic.AspNetCore.Mvc.Tests/ValidateTopicAttributeTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
\=============================================================================================================================*/
66
using System;
77
using System.Collections.Generic;
8-
using OnTopic.AspNetCore.Mvc;
9-
using OnTopic.AspNetCore.Mvc.Controllers;
10-
using OnTopic.Attributes;
11-
using OnTopic.TestDoubles;
128
using Microsoft.AspNetCore.Http;
139
using Microsoft.AspNetCore.Mvc;
1410
using Microsoft.AspNetCore.Mvc.Controllers;
1511
using Microsoft.AspNetCore.Mvc.Filters;
1612
using Microsoft.AspNetCore.Mvc.ModelBinding;
1713
using Microsoft.AspNetCore.Routing;
1814
using Microsoft.VisualStudio.TestTools.UnitTesting;
15+
using OnTopic.AspNetCore.Mvc;
16+
using OnTopic.AspNetCore.Mvc.Controllers;
17+
using OnTopic.Attributes;
18+
using OnTopic.TestDoubles;
1919

2020
namespace OnTopic.Tests {
2121

OnTopic.AspNetCore.Mvc/Components/MenuViewComponentBase{T}.cs

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
\=============================================================================================================================*/
66
using System;
77
using System.Threading.Tasks;
8+
using Microsoft.AspNetCore.Mvc;
89
using OnTopic.AspNetCore.Mvc.Models;
910
using OnTopic.Internal.Diagnostics;
1011
using OnTopic.Mapping.Hierarchical;
1112
using OnTopic.Models;
1213
using OnTopic.Repositories;
13-
using Microsoft.AspNetCore.Mvc;
1414

1515
namespace OnTopic.AspNetCore.Mvc.Components {
1616

@@ -46,7 +46,6 @@ public abstract class MenuViewComponentBase<T> :
4646
/// <summary>
4747
/// Initializes a new instance of a <see cref="MenuViewComponentBase{T}"/> with necessary dependencies.
4848
/// </summary>
49-
/// <returns>A topic controller for loading OnTopic views.</returns>
5049
protected MenuViewComponentBase(
5150
ITopicRepository topicRepository,
5251
IHierarchicalTopicMappingService<T> hierarchicalTopicMappingService
@@ -57,12 +56,16 @@ IHierarchicalTopicMappingService<T> hierarchicalTopicMappingService
5756
}
5857

5958
/*==========================================================================================================================
60-
| METHOD: INVOKE (ASYNC)
59+
| METHOD: GET NAVIGATION ROOT
6160
\-------------------------------------------------------------------------------------------------------------------------*/
61+
/// <inheritdoc />
6262
/// <summary>
63-
/// Provides the global menu for the site layout, which exposes the top two tiers of navigation.
63+
/// Retrieves the root <see cref="Topic"/> from which to map the <typeparamref name="T"/> objects.
6464
/// </summary>
65-
public async Task<IViewComponentResult> InvokeAsync() {
65+
/// <remarks>
66+
/// The navigation root in the case of the main menu is the namespace; i.e., the first topic underneath the root.
67+
/// </remarks>
68+
protected Topic? GetNavigationRoot() {
6669

6770
/*------------------------------------------------------------------------------------------------------------------------
6871
| Validate dependencies
@@ -71,8 +74,6 @@ public async Task<IViewComponentResult> InvokeAsync() {
7174

7275
/*------------------------------------------------------------------------------------------------------------------------
7376
| Identify navigation root
74-
>-------------------------------------------------------------------------------------------------------------------------
75-
| The navigation root in the case of the main menu is the namespace; i.e., the first topic underneath the root.
7677
\-----------------------------------------------------------------------------------------------------------------------*/
7778
var navigationRootTopic = (Topic?)null;
7879
var configuredRoot = CurrentTopic.Attributes.GetValue("NavigationRoot", true);
@@ -84,18 +85,45 @@ public async Task<IViewComponentResult> InvokeAsync() {
8485
navigationRootTopic = HierarchicalTopicMappingService.GetHierarchicalRoot(CurrentTopic, 2, "Web");
8586
}
8687

87-
var navigationRoot = await HierarchicalTopicMappingService.GetRootViewModelAsync(
88+
/*------------------------------------------------------------------------------------------------------------------------
89+
| Return root
90+
\-----------------------------------------------------------------------------------------------------------------------*/
91+
return navigationRootTopic;
92+
93+
}
94+
95+
/*==========================================================================================================================
96+
| METHOD: MAP NAVIGATION TOPIC VIEW MODELS
97+
\-------------------------------------------------------------------------------------------------------------------------*/
98+
/// <summary>
99+
/// Maps a list of <typeparamref name="T"/> instances based on the <paramref name="navigationRootTopic"/>.
100+
/// </summary>
101+
protected async Task<T?> MapNavigationTopicViewModels(Topic? navigationRootTopic) =>
102+
await HierarchicalTopicMappingService.GetRootViewModelAsync(
88103
navigationRootTopic!,
89104
3,
90105
t => t.ContentType != "PageGroup"
91106
).ConfigureAwait(false);
92107

108+
/*==========================================================================================================================
109+
| METHOD: INVOKE (ASYNC)
110+
\-------------------------------------------------------------------------------------------------------------------------*/
111+
/// <summary>
112+
/// Provides the global menu for the site layout, which exposes the top two tiers of navigation.
113+
/// </summary>
114+
public async Task<IViewComponentResult> InvokeAsync() {
115+
116+
/*------------------------------------------------------------------------------------------------------------------------
117+
| Retrieve root topic
118+
\-----------------------------------------------------------------------------------------------------------------------*/
119+
var navigationRootTopic = GetNavigationRoot();
120+
93121
/*------------------------------------------------------------------------------------------------------------------------
94122
| Construct view model
95123
\-----------------------------------------------------------------------------------------------------------------------*/
96-
var navigationViewModel = new NavigationViewModel<T>() {
97-
NavigationRoot = navigationRoot,
98-
CurrentKey = CurrentTopic?.GetUniqueKey()?? HttpContext.Request.Path
124+
var navigationViewModel = new NavigationViewModel<T>() {
125+
NavigationRoot = await MapNavigationTopicViewModels(navigationRootTopic).ConfigureAwait(true),
126+
CurrentKey = CurrentTopic?.GetUniqueKey()?? HttpContext.Request.Path
99127
};
100128

101129
/*------------------------------------------------------------------------------------------------------------------------

OnTopic.AspNetCore.Mvc/Components/NavigationTopicViewComponentBase{T}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6+
using Microsoft.AspNetCore.Mvc;
67
using OnTopic.Mapping.Hierarchical;
78
using OnTopic.Models;
89
using OnTopic.Repositories;
9-
using Microsoft.AspNetCore.Mvc;
1010

1111
namespace OnTopic.AspNetCore.Mvc.Components {
1212

@@ -27,7 +27,7 @@ namespace OnTopic.AspNetCore.Mvc.Components {
2727
/*==========================================================================================================================
2828
| PRIVATE VARIABLES
2929
\-------------------------------------------------------------------------------------------------------------------------*/
30-
private Topic? _currentTopic = null;
30+
private Topic? _currentTopic;
3131

3232
/*==========================================================================================================================
3333
| CONSTRUCTOR

0 commit comments

Comments
 (0)