Skip to content

Commit ddabde1

Browse files
committed
Moved content type view models into a _contentTypes folder
This doesn't change the namespace, just helps organize the file structure a bit. The `_camelCase` folders are being used to differentiate namespaces from organizational folders.
1 parent a165f74 commit ddabde1

8 files changed

Lines changed: 13 additions & 13 deletions

OnTopic.ViewModels/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ Installation can be performed by providing a `<PackageReference /`> to the `OnTo
3131
3232
## Inventory
3333
- [`TopicViewModel`](TopicViewModel.cs)
34-
- [`PageTopicViewModel`](PageTopicViewModel.cs)
35-
- [`ContentListTopicViewModel`](ContentListTopicViewModel.cs) ([`ContentItemTopicViewModel`](Items/ContentItemTopicViewModel.cs))
36-
- [`IndexTopicViewModel`](IndexTopicViewModel.cs)
37-
- [`SlideshowTopicViewModel`](SlideshowTopicViewModel.cs) ([`SlideTopicViewModel`](Items/SlideTopicViewModel.cs))
38-
- [`VideoTopicViewModel`](VideoTopicViewModel.cs)
39-
- [`SectionTopicViewModel`](SectionTopicViewModel.cs)
40-
- [`PageGroupTopicViewModel`](PageGroupTopicViewModel.cs)
34+
- [`PageTopicViewModel`](_contentTypes/PageTopicViewModel.cs)
35+
- [`ContentListTopicViewModel`](_contentTypes/ContentListTopicViewModel.cs) ([`ContentItemTopicViewModel`](_items/ContentItemTopicViewModel.cs))
36+
- [`IndexTopicViewModel`](_contentTypes/IndexTopicViewModel.cs)
37+
- [`SlideshowTopicViewModel`](_contentTypes/SlideshowTopicViewModel.cs) ([`SlideTopicViewModel`](_items/SlideTopicViewModel.cs))
38+
- [`VideoTopicViewModel`](_contentTypes/VideoTopicViewModel.cs)
39+
- [`SectionTopicViewModel`](_contentTypes/SectionTopicViewModel.cs)
40+
- [`PageGroupTopicViewModel`](_contentTypes/PageGroupTopicViewModel.cs)
4141
- [`NavigationTopicViewModel`](NavigationTopicViewModel.cs)
42-
- [`ItemTopicViewModel`](Items/ItemTopicViewModel.cs)
43-
- [`ContentItemTopicViewModel`](Items/ContentItemTopicViewModel.cs)
44-
- [`LookupListItemTopicViewModel`](Items/LookupListItemTopicViewModel.cs)
45-
- [`SlideTopicViewModel`](Items/SlideTopicViewModel.cs)
42+
- [`ItemTopicViewModel`](_items/ItemTopicViewModel.cs)
43+
- [`ContentItemTopicViewModel`](_items/ContentItemTopicViewModel.cs)
44+
- [`LookupListItemTopicViewModel`](_items/LookupListItemTopicViewModel.cs)
45+
- [`SlideTopicViewModel`](_items/SlideTopicViewModel.cs)
4646
- [`AssociatedTopicBindingModel`](BindingModels/AssociatedTopicBindingModel.cs)
4747
- [`TopicViewModelLookupService`](TopicViewModelLookupService.cs)
48-
- [`TopicViewModelCollection<>`](Collections/TopicViewModelCollection.cs)
48+
- [`TopicViewModelCollection<>`](_collections/TopicViewModelCollection.cs)
4949

5050
## Usage
5151
By default, the [`OnTopic.AspNetCore.Mvc`](../OnTopic.AspNetCore.Mvc/README.md)'s [`TopicController`](../OnTopic.AspNetCore.Mvc/Controllers/TopicController.cs) uses the out-of-the-box [`TopicMappingService`](../OnTopic/Mapping) to map topics to view models. For applications primarily relying on the out-of-the-box view models, it is recommended that the [`TopicViewModelLookupService`](TopicViewModelLookupService.cs) be used; this includes all of the out-of-the-box view models, and can be derived to add application-specific view models.
@@ -62,6 +62,6 @@ As view models, not all attributes and associations are exposed. The properties
6262
All of the view models assume a parameterless constructor (e.g., `new TopicViewModel()`), which can optionally be the default constructor if no other constructors are required. This is necessary to provide compatibility with the `TopicMappingService`, which will attempt to create new instances of view models based on the the topic's `ContentType`, using the view models parameterless constructor.
6363

6464
### Inheritance
65-
The view models map to the hierarchy of the content types in OnTopic, with each view model only including properties that are _specific_ to that content type. So, for example, [`PageTopicViewModel`](PageTopicViewModel.cs) includes a `Body` property, which is introduced by the `Page` content type, but doesn't include e.g. `Key`, `ContentType`, or `Title`; these are all inherited from the base [`TopicViewModel`](TopicViewModel.cs).
65+
The view models map to the hierarchy of the content types in OnTopic, with each view model only including properties that are _specific_ to that content type. So, for example, [`PageTopicViewModel`](_contentTypes/PageTopicViewModel.cs) includes a `Body` property, which is introduced by the `Page` content type, but doesn't include e.g. `Key`, `ContentType`, or `Title`; these are all inherited from the base [`TopicViewModel`](TopicViewModel.cs).
6666

6767
This is advantageous not only because it effectively models the familiar content type hierarchy, but also because it allows for polymorphism in the mapping library. So, for example, if a property accepts a `Collection<PageTopicViewModel>`, then this can also contain any view models that derive from the `PageTopicViewModel` (e.g., `SlideshowTopicViewModel`, `VideoTopicViewModel`, &c.).

OnTopic.ViewModels/ContentListTopicViewModel.cs renamed to OnTopic.ViewModels/_contentTypes/ContentListTopicViewModel.cs

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)