diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..4cdabdb3 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,33 @@ + + + + 9.0 + enable + latest + AllEnabledByDefault + + + + Ignia + OnTopic + ©2021 Ignia, LLC + Ignia + https://github.com/Ignia/Topics-Library + true + en + true + true + true + true + Icon.png + + + + + + + + true + + + \ No newline at end of file diff --git a/Icon.png b/Icon.png new file mode 100644 index 00000000..63cd745a Binary files /dev/null and b/Icon.png differ diff --git a/OnTopic.All/OnTopic.All.csproj b/OnTopic.All/OnTopic.All.csproj new file mode 100644 index 00000000..47d362c4 --- /dev/null +++ b/OnTopic.All/OnTopic.All.csproj @@ -0,0 +1,28 @@ + + + + netcoreapp3.1 + + + + OnTopic Library Metapackage + Includes all core packages associated with the OnTopic Library, excluding the OnTopic Editor. Reference this package as a shorthand for establishing a reference to each of the individual packages. + bin\$(Configuration)\ + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + diff --git a/OnTopic.All/Properties/AssemblyInfo.cs b/OnTopic.All/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..bcdd7ce1 --- /dev/null +++ b/OnTopic.All/Properties/AssemblyInfo.cs @@ -0,0 +1,15 @@ +/*============================================================================================================================== +| Author Ignia, LLC +| Client Ignia, LLC +| Project Topics Library +\=============================================================================================================================*/ +using System; +using System.Runtime.InteropServices; + +/*============================================================================================================================== +| DEFINE ASSEMBLY ATTRIBUTES +>=============================================================================================================================== +| Declare and define attributes used in the compiling of the finished assembly. +\-----------------------------------------------------------------------------------------------------------------------------*/ +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] \ No newline at end of file diff --git a/OnTopic.All/README.md b/OnTopic.All/README.md new file mode 100644 index 00000000..307ea93c --- /dev/null +++ b/OnTopic.All/README.md @@ -0,0 +1,31 @@ +# OnTopic Metapackage +The `OnTopic.All` metapackage includes a reference to the core OnTopic libraries that most implementations will require. It is recommended that implementers reference this package instead of referencing each of the OnTopic packages individually, unless they have a specific need to customize which packages are referenced. + +[![OnTopic.Data.Caching package in Internal feed in Azure Artifacts](https://igniasoftware.feeds.visualstudio.com/_apis/public/Packaging/Feeds/46d5f49c-5e1e-47bb-8b14-43be6c719ba8/Packages/3dfb3a0a-c049-407d-959e-546f714dcd0f/Badge)](https://igniasoftware.visualstudio.com/OnTopic/_packaging?_a=package&feed=46d5f49c-5e1e-47bb-8b14-43be6c719ba8&package=3dfb3a0a-c049-407d-959e-546f714dcd0f&preferRelease=true) +[![Build Status](https://igniasoftware.visualstudio.com/OnTopic/_apis/build/status/OnTopic-CI-V3?branchName=master)](https://igniasoftware.visualstudio.com/OnTopic/_build/latest?definitionId=7&branchName=master) +![NuGet Deployment Status](https://rmsprodscussu1.vsrm.visualstudio.com/A09668467-721c-4517-8d2e-aedbe2a7d67f/_apis/public/Release/badge/bd7f03e0-6fcf-4ec6-939d-4e995668d40f/2/2) + +### Contents +- [Scope](#scope) +- [Installation](#installation) + +## Scope +The `OnTopic.All` metapackage maintains a reference to the following packages: +- [`OnTopic`](../OnTopic/README.md): The core OnTopic library. +- [`OnTopic.AspNetCore.Mvc`](../OnTopic.AspNetCore.Mvc/README.md): The ASP.NET Core implementation, with support for both ASP.NET Core 3.x and ASP.NET Core 5.x. +- [`OnTopic.Data.Caching`](../OnTopic.Data.Caching/README.md): An `ITopicRepository` decorator for caching the topic graph in memory. +- [`OnTopic.Data.Sql`](../OnTopic.Data.Sql/README.md): An `ITopicRepository` implementation for persisting topic data in a SQL Server database. +- [`OnTopic.ViewModels`](../OnTopic.ViewModels/README.md): A set of reference view models and binding models mapping to the out-of-the-box schema for the standard content types. + +## Installation +Installation can be performed by providing a ` to the `OnTopic.All` **NuGet** package. +```xml + + … + + + + +``` + +> *Note:* This package is currently only available on Ignia's private **NuGet** repository. For access, please contact [Ignia](http://www.ignia.com/). \ No newline at end of file diff --git a/OnTopic.AspNetCore.Mvc.Host/Components/MenuViewComponent.cs b/OnTopic.AspNetCore.Mvc.Host/Components/MenuViewComponent.cs index 4baef619..1ba0cd78 100644 --- a/OnTopic.AspNetCore.Mvc.Host/Components/MenuViewComponent.cs +++ b/OnTopic.AspNetCore.Mvc.Host/Components/MenuViewComponent.cs @@ -5,6 +5,7 @@ \=============================================================================================================================*/ using Microsoft.AspNetCore.Mvc; using OnTopic.AspNetCore.Mvc.Components; +using OnTopic.AspNetCore.Mvc.Controllers; using OnTopic.AspNetCore.Mvc.Models; using OnTopic.Mapping.Hierarchical; using OnTopic.Repositories; @@ -16,7 +17,7 @@ namespace OnTopic.AspNetCore.Mvc.Host.Components { | CLASS: MENU VIEW COMPONENT \---------------------------------------------------------------------------------------------------------------------------*/ /// - /// Defines a which provides access to a menu of + /// Defines a which provides access to a menu of /// instances. /// /// diff --git a/OnTopic.AspNetCore.Mvc.Host/Components/PageLevelNavigationViewComponent.cs b/OnTopic.AspNetCore.Mvc.Host/Components/PageLevelNavigationViewComponent.cs index efa07736..d054347e 100644 --- a/OnTopic.AspNetCore.Mvc.Host/Components/PageLevelNavigationViewComponent.cs +++ b/OnTopic.AspNetCore.Mvc.Host/Components/PageLevelNavigationViewComponent.cs @@ -5,6 +5,7 @@ \=============================================================================================================================*/ using Microsoft.AspNetCore.Mvc; using OnTopic.AspNetCore.Mvc.Components; +using OnTopic.AspNetCore.Mvc.Controllers; using OnTopic.AspNetCore.Mvc.Models; using OnTopic.Mapping.Hierarchical; using OnTopic.Repositories; @@ -16,15 +17,14 @@ namespace OnTopic.AspNetCore.Mvc.Host.Components { | CLASS: PAGE-LEVEL NAVIGATION VIEW COMPONENT \---------------------------------------------------------------------------------------------------------------------------*/ /// - /// Defines a which provides access to a menu of + /// Defines a which provides access to a menu of /// instances representing the nearest page-level navigation. /// /// /// /// As a best practice, global data required by the layout view are requested independent of the current page. This - /// allows each layout element to be provided with its own layout data, in the form of s, instead of needing to add this data to every view model returned by . + /// allows each layout element to be provided with its own layout data, in the form of s, instead of needing to add this data to every view model returned by . /// /// public class PageLevelNavigationViewComponent : PageLevelNavigationViewComponentBase { diff --git a/OnTopic.AspNetCore.Mvc.Host/OnTopic.AspNetCore.Mvc.Host.csproj b/OnTopic.AspNetCore.Mvc.Host/OnTopic.AspNetCore.Mvc.Host.csproj index da24af8d..097a454b 100644 --- a/OnTopic.AspNetCore.Mvc.Host/OnTopic.AspNetCore.Mvc.Host.csproj +++ b/OnTopic.AspNetCore.Mvc.Host/OnTopic.AspNetCore.Mvc.Host.csproj @@ -1,17 +1,20 @@  - netcoreapp3.1 + net5.0 62eb85bf-f802-4afd-8bec-3d344e1cfc79 false - - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - + + + + + \ No newline at end of file diff --git a/OnTopic.AspNetCore.Mvc.Host/Properties/AssemblyInfo.cs b/OnTopic.AspNetCore.Mvc.Host/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..bcdd7ce1 --- /dev/null +++ b/OnTopic.AspNetCore.Mvc.Host/Properties/AssemblyInfo.cs @@ -0,0 +1,15 @@ +/*============================================================================================================================== +| Author Ignia, LLC +| Client Ignia, LLC +| Project Topics Library +\=============================================================================================================================*/ +using System; +using System.Runtime.InteropServices; + +/*============================================================================================================================== +| DEFINE ASSEMBLY ATTRIBUTES +>=============================================================================================================================== +| Declare and define attributes used in the compiling of the finished assembly. +\-----------------------------------------------------------------------------------------------------------------------------*/ +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] \ No newline at end of file diff --git a/OnTopic.AspNetCore.Mvc.Host/SampleActivator.cs b/OnTopic.AspNetCore.Mvc.Host/SampleActivator.cs index 3126ab9f..e53b62fa 100644 --- a/OnTopic.AspNetCore.Mvc.Host/SampleActivator.cs +++ b/OnTopic.AspNetCore.Mvc.Host/SampleActivator.cs @@ -11,9 +11,10 @@ using OnTopic.AspNetCore.Mvc.Host.Components; using OnTopic.Data.Caching; using OnTopic.Data.Sql; +using OnTopic.Internal.Diagnostics; +using OnTopic.Lookup; using OnTopic.Mapping; using OnTopic.Mapping.Hierarchical; -using OnTopic.Reflection; using OnTopic.Repositories; using OnTopic.ViewModels; @@ -31,21 +32,22 @@ public class SampleActivator : IControllerActivator, IViewComponentActivator { /*========================================================================================================================== | PRIVATE INSTANCES \-------------------------------------------------------------------------------------------------------------------------*/ - private readonly ITypeLookupService _typeLookupService = null; - private readonly ITopicMappingService _topicMappingService = null; - private readonly ITopicRepository _topicRepository = null; + private readonly ITypeLookupService _typeLookupService; + private readonly ITopicMappingService _topicMappingService; + private readonly ITopicRepository _topicRepository; + private DateTime _cacheLastUpdated = DateTime.UtcNow; /*========================================================================================================================== | HIERARCHICAL TOPIC MAPPING SERVICE \-------------------------------------------------------------------------------------------------------------------------*/ - private readonly IHierarchicalTopicMappingService _hierarchicalMappingService = null; + private readonly IHierarchicalTopicMappingService _hierarchicalMappingService; /*========================================================================================================================== | CONSTRUCTOR \-------------------------------------------------------------------------------------------------------------------------*/ /// - /// Establishes a new instance of the , including any shared dependencies to be used - /// across instances of controllers. + /// Establishes a new instance of the , including any shared dependencies to be used across + /// instances of controllers. /// /// /// The constructor is responsible for establishing dependencies with the singleton lifestyle so that they are available @@ -86,14 +88,28 @@ public SampleActivator(string connectionString) { /// /// Registers dependencies, and injects them into new instances of controllers in response to each request. /// - /// A concrete instance of an . + /// A concrete instance of an . public object Create(ControllerContext context) { + /*------------------------------------------------------------------------------------------------------------------------ + | Validate parameters + \-----------------------------------------------------------------------------------------------------------------------*/ + Contract.Requires(context, nameof(context)); + /*------------------------------------------------------------------------------------------------------------------------ | Determine controller type \-----------------------------------------------------------------------------------------------------------------------*/ var type = context.ActionDescriptor.ControllerTypeInfo.AsType(); + /*------------------------------------------------------------------------------------------------------------------------ + | Periodically update cache + \-----------------------------------------------------------------------------------------------------------------------*/ + if (DateTime.UtcNow > _cacheLastUpdated.AddMinutes(1)) { + var currentUpdate = DateTime.UtcNow; + _topicRepository.Refresh(_topicRepository.Load()!, _cacheLastUpdated); + _cacheLastUpdated = currentUpdate; + } + /*------------------------------------------------------------------------------------------------------------------------ | Configure and return appropriate controller \-----------------------------------------------------------------------------------------------------------------------*/ @@ -104,7 +120,7 @@ public object Create(ControllerContext context) { new SitemapController(_topicRepository), nameof(RedirectController) => new RedirectController(_topicRepository), - _ => throw new Exception($"Unknown controller {type.Name}") + _ => throw new InvalidOperationException($"Unknown controller {type.Name}") }; } @@ -112,9 +128,14 @@ public object Create(ControllerContext context) { /// /// Registers dependencies, and injects them into new instances of view components in response to each request. /// - /// A concrete instance of an . + /// A concrete instance of an . public object Create(ViewComponentContext context) { + /*------------------------------------------------------------------------------------------------------------------------ + | Validate parameters + \-----------------------------------------------------------------------------------------------------------------------*/ + Contract.Requires(context, nameof(context)); + /*------------------------------------------------------------------------------------------------------------------------ | Determine view component type \-----------------------------------------------------------------------------------------------------------------------*/ @@ -128,7 +149,7 @@ public object Create(ViewComponentContext context) { new MenuViewComponent(_topicRepository, _hierarchicalMappingService), nameof(PageLevelNavigationViewComponent) => new PageLevelNavigationViewComponent(_topicRepository, _hierarchicalMappingService), - _ => throw new Exception($"Unknown view component {type.Name}") + _ => throw new InvalidOperationException($"Unknown view component {type.Name}") }; } diff --git a/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/Accordion.cshtml b/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/Accordion.cshtml index ce32ef5b..04b3d1d4 100644 --- a/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/Accordion.cshtml +++ b/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/Accordion.cshtml @@ -1,7 +1,7 @@ -@Html.PartialAsync("~/Views/ContentList/ContentList.cshtml") + +--> \ No newline at end of file diff --git a/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/ContentList.cshtml b/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/ContentList.cshtml index 36e6cb78..aab88b85 100644 --- a/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/ContentList.cshtml +++ b/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/ContentList.cshtml @@ -27,4 +27,4 @@ Content Type: Content List View Type: Accordion View Location: ~/Views/ContentList/Accordion.cshtml ---> +--> \ No newline at end of file diff --git a/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/IndexedList.cshtml b/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/IndexedList.cshtml index 31b611e7..a0519cf9 100644 --- a/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/IndexedList.cshtml +++ b/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/IndexedList.cshtml @@ -1,7 +1,7 @@ -@Html.PartialAsync("~/Views/ContentList/ContentList.cshtml") + +--> \ No newline at end of file diff --git a/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/LinkedList.cshtml b/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/LinkedList.cshtml index 9d08976a..d37eb323 100644 --- a/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/LinkedList.cshtml +++ b/OnTopic.AspNetCore.Mvc.Host/Views/ContentList/LinkedList.cshtml @@ -1,7 +1,7 @@ -@Html.PartialAsync("~/Views/ContentList/ContentList.cshtml") + +--> \ No newline at end of file diff --git a/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/Page.cshtml b/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/Page.cshtml index 007d839a..c1a9dcd3 100644 --- a/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/Page.cshtml +++ b/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/Page.cshtml @@ -5,4 +5,4 @@ +--> \ No newline at end of file diff --git a/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/PageGroup.cshtml b/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/PageGroup.cshtml index c16cb146..d8e5bcb3 100644 --- a/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/PageGroup.cshtml +++ b/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/PageGroup.cshtml @@ -3,4 +3,4 @@ +--> \ No newline at end of file diff --git a/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/Slideshow.cshtml b/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/Slideshow.cshtml new file mode 100644 index 00000000..191a3c87 --- /dev/null +++ b/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/Slideshow.cshtml @@ -0,0 +1,27 @@ +@model SlideshowTopicViewModel + + + +

Attributes

+
    +
  • TransitionEffect: @Model.TransitionEffect
  • +
+ +

Collections

+ +

Slides

+@foreach (var contentItem in Model.ContentItems) { +

@contentItem.Key

+
    +
  • Title: @contentItem.Title
  • +
  • Category: @contentItem.Category
  • +
  • Learn More
  • +
  • +
  • Description: @contentItem.Description
  • +
+} + + \ No newline at end of file diff --git a/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/Video.cshtml b/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/Video.cshtml index 0958f061..056e37ec 100644 --- a/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/Video.cshtml +++ b/OnTopic.AspNetCore.Mvc.Host/Views/ContentTypes/Video.cshtml @@ -11,4 +11,4 @@ +--> \ No newline at end of file diff --git a/OnTopic.AspNetCore.Mvc.Host/Views/Shared/Components/Menu/Default.cshtml b/OnTopic.AspNetCore.Mvc.Host/Views/Shared/Components/Menu/Default.cshtml index 5a7cd088..6c01ca42 100644 --- a/OnTopic.AspNetCore.Mvc.Host/Views/Shared/Components/Menu/Default.cshtml +++ b/OnTopic.AspNetCore.Mvc.Host/Views/Shared/Components/Menu/Default.cshtml @@ -3,7 +3,7 @@

Menu