Skip to content

Commit a259509

Browse files
committed
Moved/Renamed I…TopicViewModel classes
Moved `I…TopicViewModelCore` classes to `ViewModels\I…TopicViewModel`. The core made the interfaces unnecessarily wordy. And there are enough of them that it's more manageable to have them segmented into their own namespace now.
1 parent fac1d8c commit a259509

13 files changed

Lines changed: 34 additions & 30 deletions

Ignia.Topics.ViewModels/NavigationTopicViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Ignia.Topics.ViewModels {
2626
/// cref="NavigationTopicViewModel"/> class is marked as <c>sealed</c>.
2727
/// </para>
2828
/// </remarks>
29-
public sealed class NavigationTopicViewModel : PageTopicViewModel, INavigationTopicViewModelCore<NavigationTopicViewModel> {
29+
public sealed class NavigationTopicViewModel : PageTopicViewModel, INavigationTopicViewModel<NavigationTopicViewModel> {
3030

3131
public Collection<NavigationTopicViewModel> Children { get; set; }
3232
public bool IsSelected(string uniqueKey) => uniqueKey?.StartsWith(UniqueKey) ?? false;

Ignia.Topics.ViewModels/PageTopicViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Ignia.Topics.ViewModels {
1717
/// default implementations that can be used directly, used as base classes, or overwritten at the presentative level. They
1818
/// are supplied for convenience to model factory default settings for out-of-the-box content types.
1919
/// </remarks>
20-
public class PageTopicViewModel: TopicViewModel, IPageTopicViewModelCore {
20+
public class PageTopicViewModel: TopicViewModel, IPageTopicViewModel {
2121

2222
public string Subtitle { get; set; }
2323
public string WebPath { get; set; }

Ignia.Topics.ViewModels/TopicViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Ignia.Topics.ViewModels {
1919
/// default implementations that can be used directly, used as base classes, or overwritten at the presentative level. They
2020
/// are supplied for convenience to model factory default settings for out-of-the-box content types.
2121
/// </remarks>
22-
public class TopicViewModel: ITopicViewModelCore {
22+
public class TopicViewModel: ITopicViewModel {
2323

2424
public int Id { get; set; }
2525
public string Key { get; set; }

Ignia.Topics.ViewModels/TopicViewModelCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Ignia.Topics.ViewModels {
2323
/// default implementations that can be used directly, used as base classes, or overwritten at the presentative level. They
2424
/// are supplied for convenience to model factory default settings for out-of-the-box content types.
2525
/// </remarks>
26-
public class TopicViewModelCollection<TItem>: KeyedCollection<string, TItem> where TItem: ITopicViewModelCore {
26+
public class TopicViewModelCollection<TItem>: KeyedCollection<string, TItem> where TItem: ITopicViewModel {
2727

2828
/*==========================================================================================================================
2929
| CONSTRUCTOR

Ignia.Topics.Web.Mvc/Controllers/ErrorControllerBase{T}.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
| Project Topics Library
55
\=============================================================================================================================*/
66
using System.Web.Mvc;
7+
using Ignia.Topics.ViewModels;
78

89
namespace Ignia.Topics.Web.Mvc.Controllers {
910

@@ -27,7 +28,7 @@ namespace Ignia.Topics.Web.Mvc.Controllers {
2728
/// <c>abstract</c> and suffixed with <b>Base</b>.
2829
/// </para>
2930
/// </remarks>
30-
public abstract class ErrorControllerBase<T> : Controller where T : IPageTopicViewModelCore, new() {
31+
public abstract class ErrorControllerBase<T> : Controller where T : IPageTopicViewModel, new() {
3132

3233
/*==========================================================================================================================
3334
| GET: /Error/Error

Ignia.Topics.Web.Mvc/Controllers/LayoutControllerBase{T}.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Web.Mvc;
99
using Ignia.Topics.Mapping;
1010
using Ignia.Topics.Repositories;
11+
using Ignia.Topics.ViewModels;
1112
using Ignia.Topics.Web.Mvc.Models;
1213

1314
namespace Ignia.Topics.Web.Mvc.Controllers {
@@ -37,7 +38,7 @@ namespace Ignia.Topics.Web.Mvc.Controllers {
3738
/// <c>abstract</c> and suffixed with <c>Base</c>.
3839
/// </para>
3940
/// </remarks>
40-
public abstract class LayoutControllerBase<T> : Controller where T : class, INavigationTopicViewModelCore<T>, new() {
41+
public abstract class LayoutControllerBase<T> : Controller where T : class, INavigationTopicViewModel<T>, new() {
4142

4243
/*==========================================================================================================================
4344
| PRIVATE VARIABLES

Ignia.Topics.Web.Mvc/Models/NavigationViewModel{T}.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
| Project Topics Library
55
\=============================================================================================================================*/
66

7+
using Ignia.Topics.ViewModels;
8+
79
namespace Ignia.Topics.Web.Mvc.Models {
810

911
/*============================================================================================================================
@@ -24,7 +26,7 @@ namespace Ignia.Topics.Web.Mvc.Models {
2426
/// topic. Implementations may support additional properties, as appropriate.
2527
/// </para>
2628
/// </remarks>
27-
public class NavigationViewModel<T> where T: IPageTopicViewModelCore {
29+
public class NavigationViewModel<T> where T: IPageTopicViewModel {
2830

2931
public T NavigationRoot { get; set; }
3032
public string CurrentKey { get; set; }

Ignia.Topics.Web.Mvc/TopicViewResult.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Collections.Generic;
88
using System.Linq;
99
using System.Web.Mvc;
10+
using Ignia.Topics.ViewModels;
1011

1112
namespace Ignia.Topics.Web.Mvc {
1213

@@ -36,7 +37,7 @@ public class TopicViewResult : ViewResult {
3637
/// cref="ITopicViewModelCore.View"/> is unavailable, it is assumed to be the same as the <see
3738
/// cref="ITopicViewModelCore.ContentType"/>.
3839
/// </remarks>
39-
public TopicViewResult(ITopicViewModelCore viewModel) : base() {
40+
public TopicViewResult(ITopicViewModel viewModel) : base() {
4041
ViewData.Model = viewModel;
4142
_contentType = viewModel.ContentType ?? "Page";
4243
_topicView = viewModel.View ?? _contentType;

Ignia.Topics/Ignia.Topics.csproj

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,14 @@
134134
<Compile Include="Collections\TopicCollection.cs" />
135135
<Compile Include="Collections\ContentTypeDescriptorCollection.cs" />
136136
<Compile Include="Collections\TopicCollection{T}.cs" />
137-
<Compile Include="ContentType.cs" />
138-
<Compile Include="Attribute.cs" />
139137
<Compile Include="AttributeSetterAttribute.cs" />
140138
<Compile Include="Collections\AttributeValueCollection.cs" />
141139
<Compile Include="Collections\NamedTopicCollection.cs" />
142140
<Compile Include="Collections\TypeCollection.cs" />
143141
<Compile Include="Collections\PropertyInfoCollection.cs" />
144142
<Compile Include="ContentTypeDescriptor.cs" />
145-
<Compile Include="INavigationTopicViewModelCore{T}.cs" />
146143
<Compile Include="InvalidKeyException.cs" />
147144
<Compile Include="ITopicRoutingService.cs" />
148-
<Compile Include="IPageTopicViewModelCore.cs" />
149-
<Compile Include="ITopicViewModelCore.cs" />
150145
<Compile Include="Mapping\CachedTopicMappingService.cs" />
151146
<Compile Include="Mapping\FilterByAttributeAttribute.cs" />
152147
<Compile Include="Mapping\AttributeKeyAttribute.cs" />
@@ -170,6 +165,9 @@
170165
<Compile Include="Topic.cs" />
171166
<Compile Include="Properties\AssemblyInfo.cs" />
172167
<Compile Include="TopicFactory.cs" />
168+
<Compile Include="ViewModels\INavigationTopicViewModel{T}.cs" />
169+
<Compile Include="ViewModels\IPageTopicViewModel.cs" />
170+
<Compile Include="ViewModels\ITopicViewModel.cs" />
173171
</ItemGroup>
174172
<ItemGroup />
175173
<ItemGroup>

Ignia.Topics/Mapping/TopicMappingService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using System.Reflection;
1414
using Ignia.Topics.Collections;
1515
using Ignia.Topics.Repositories;
16+
using Ignia.Topics.ViewModels;
1617

1718
namespace Ignia.Topics.Mapping {
1819

@@ -352,7 +353,7 @@ private void SetProperty(Topic topic, object target, Relationships relationships
352353
else if (typeof(IList).IsAssignableFrom(property.PropertyType)) {
353354

354355
//Determine the type of item in the list
355-
var listType = typeof(ITopicViewModelCore);
356+
var listType = typeof(ITopicViewModel);
356357
if (property.PropertyType.IsGenericType) {
357358
//Uses last argument in case it's a KeyedCollection; in that case, we want the TItem type
358359
listType = property.PropertyType.GetGenericArguments().Last();

0 commit comments

Comments
 (0)