diff --git a/Gibe.Umbraco.Blog.Tests/Gibe.Umbraco.Blog.Tests.csproj b/Gibe.Umbraco.Blog.Tests/Gibe.Umbraco.Blog.Tests.csproj index 53cb4ae..f6b0250 100644 --- a/Gibe.Umbraco.Blog.Tests/Gibe.Umbraco.Blog.Tests.csproj +++ b/Gibe.Umbraco.Blog.Tests/Gibe.Umbraco.Blog.Tests.csproj @@ -1,16 +1,16 @@  - net6.0 + net10.0 false - - NET6 + + NET10 - - + + diff --git a/Gibe.Umbraco.Blog.sln b/Gibe.Umbraco.Blog.sln deleted file mode 100644 index 0e1789e..0000000 --- a/Gibe.Umbraco.Blog.sln +++ /dev/null @@ -1,42 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31912.275 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gibe.Umbraco.Blog", "Gibe.Umbraco.Blog\Gibe.Umbraco.Blog.csproj", "{5E7B7B56-7CA0-4E67-B6F4-E4257EB263D5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gibe.Umbraco.Blog.Tests", "Gibe.Umbraco.Blog.Tests\Gibe.Umbraco.Blog.Tests.csproj", "{8CE36655-ED65-444C-9101-3A986C317C3F}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D8F40142-8850-4A21-B19D-3AFF1382533D}" - ProjectSection(SolutionItems) = preProject - Readme.md = Readme.md - VERSION.txt = VERSION.txt - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Admin|Any CPU = Admin|Any CPU - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5E7B7B56-7CA0-4E67-B6F4-E4257EB263D5}.Admin|Any CPU.ActiveCfg = Admin|Any CPU - {5E7B7B56-7CA0-4E67-B6F4-E4257EB263D5}.Admin|Any CPU.Build.0 = Admin|Any CPU - {5E7B7B56-7CA0-4E67-B6F4-E4257EB263D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5E7B7B56-7CA0-4E67-B6F4-E4257EB263D5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5E7B7B56-7CA0-4E67-B6F4-E4257EB263D5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5E7B7B56-7CA0-4E67-B6F4-E4257EB263D5}.Release|Any CPU.Build.0 = Release|Any CPU - {8CE36655-ED65-444C-9101-3A986C317C3F}.Admin|Any CPU.ActiveCfg = Release|Any CPU - {8CE36655-ED65-444C-9101-3A986C317C3F}.Admin|Any CPU.Build.0 = Release|Any CPU - {8CE36655-ED65-444C-9101-3A986C317C3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8CE36655-ED65-444C-9101-3A986C317C3F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8CE36655-ED65-444C-9101-3A986C317C3F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8CE36655-ED65-444C-9101-3A986C317C3F}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7670AACC-E3E2-402F-B53E-BBFD59CF6017} - EndGlobalSection -EndGlobal diff --git a/Gibe.Umbraco.Blog.slnx b/Gibe.Umbraco.Blog.slnx new file mode 100644 index 0000000..057ada1 --- /dev/null +++ b/Gibe.Umbraco.Blog.slnx @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/Gibe.Umbraco.Blog/BlogSearch.cs b/Gibe.Umbraco.Blog/BlogSearch.cs index 1c24e08..94ec846 100644 --- a/Gibe.Umbraco.Blog/BlogSearch.cs +++ b/Gibe.Umbraco.Blog/BlogSearch.cs @@ -5,6 +5,7 @@ using Gibe.Umbraco.Blog.Models; using Gibe.Umbraco.Blog.Sort; using Gibe.Umbraco.Blog.Wrappers; +using Microsoft.Extensions.Options; using StackExchange.Profiling; using Umbraco.Extensions; @@ -13,13 +14,13 @@ namespace Gibe.Umbraco.Blog public class BlogSearch : IBlogSearch { private readonly ISearchIndex _newsIndex; - private readonly IBlogSettings _blogSettings; + private readonly BlogSettings _blogSettings; public BlogSearch(ISearchIndex newsIndex, - IBlogSettings blogSettings) + IOptions blogSettings) { _newsIndex = newsIndex; - _blogSettings = blogSettings; + _blogSettings = blogSettings.Value; } public ISearchResults Search(IBlogPostFilter filter, ISort sort) diff --git a/Gibe.Umbraco.Blog/BlogSections.cs b/Gibe.Umbraco.Blog/BlogSections.cs index 1b63e72..a0a1a9f 100644 --- a/Gibe.Umbraco.Blog/BlogSections.cs +++ b/Gibe.Umbraco.Blog/BlogSections.cs @@ -3,6 +3,7 @@ using Examine; using Gibe.Umbraco.Blog.Models; using Gibe.Umbraco.Blog.Wrappers; +using Microsoft.Extensions.Options; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Extensions; @@ -12,17 +13,17 @@ namespace Gibe.Umbraco.Blog public class BlogSections : IBlogSections where T : class { private readonly ISearchIndex _searchIndex; - private readonly IBlogSettings _blogSettings; + private readonly BlogSettings _blogSettings; private readonly IPublishedContentQuery _publishedContentQuery; private readonly IPublishedValueFallback _publishedValueFallback; public BlogSections(ISearchIndex searchIndex, - IBlogSettings blogSettings, + IOptions blogSettings, IPublishedContentQuery publishedContentQuery, IPublishedValueFallback publishedValueFallback) { _searchIndex = searchIndex; - _blogSettings = blogSettings; + _blogSettings = blogSettings.Value; _publishedContentQuery = publishedContentQuery; _publishedValueFallback = publishedValueFallback; } diff --git a/Gibe.Umbraco.Blog/Composing/IndexEventsComponent.cs b/Gibe.Umbraco.Blog/Composing/IndexEventsComponent.cs index 811ba13..4dcdfbb 100644 --- a/Gibe.Umbraco.Blog/Composing/IndexEventsComponent.cs +++ b/Gibe.Umbraco.Blog/Composing/IndexEventsComponent.cs @@ -74,17 +74,17 @@ public class IndexEventsComponent : IComponent { private readonly IExamineManager _examineManager; private readonly IUserService _userService; - private readonly IBlogSettings _blogSettings; + private readonly BlogSettings _blogSettings; private readonly IUmbracoContextFactory _umbracoContextFactory; public IndexEventsComponent(IExamineManager examineManager, IUserService userService, - IBlogSettings blogSettings, + IOptions blogSettings, IUmbracoContextFactory umbracoContextFactory) { _examineManager = examineManager; _userService = userService; - _blogSettings = blogSettings; + _blogSettings = blogSettings.Value; _umbracoContextFactory = umbracoContextFactory; } diff --git a/Gibe.Umbraco.Blog/Gibe.Umbraco.Blog.csproj b/Gibe.Umbraco.Blog/Gibe.Umbraco.Blog.csproj index 6450555..c22b1dc 100644 --- a/Gibe.Umbraco.Blog/Gibe.Umbraco.Blog.csproj +++ b/Gibe.Umbraco.Blog/Gibe.Umbraco.Blog.csproj @@ -1,23 +1,23 @@  - net6.0 + net10.0 - Gibe.Umbraco.V10.Blog - 10.0.0 + Gibe.Umbraco.V13.Blog + 13.0.0 false Gibe Umbraco Blog Gibe Digital Ltd - 10.0.0 + 13.0.0 - - NET6,NET6 + + NET10,NET10 - - + + diff --git a/Gibe.Umbraco.Blog/Models/BlogAuthor.cs b/Gibe.Umbraco.Blog/Models/BlogAuthor.cs index 79e58ba..053347e 100644 --- a/Gibe.Umbraco.Blog/Models/BlogAuthor.cs +++ b/Gibe.Umbraco.Blog/Models/BlogAuthor.cs @@ -1,8 +1,4 @@ -#if NET6 -using Umbraco.Cms.Core.Models.Membership; -#elif NET472 -using Umbraco.Core.Models.Membership; -#endif +using Umbraco.Cms.Core.Models.Membership; namespace Gibe.Umbraco.Blog.Models { diff --git a/Gibe.Umbraco.Blog/Models/BlogPostBase.cs b/Gibe.Umbraco.Blog/Models/BlogPostBase.cs index 214e67b..5e03426 100644 --- a/Gibe.Umbraco.Blog/Models/BlogPostBase.cs +++ b/Gibe.Umbraco.Blog/Models/BlogPostBase.cs @@ -1,26 +1,16 @@ using System; using System.Collections.Generic; using System.Linq; -#if NET6 using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Extensions; -#elif NET472 -using Umbraco.Core.Models.PublishedContent; -using Umbraco.Web; -#endif namespace Gibe.Umbraco.Blog.Models { public abstract class BlogPostBase : PublishedContentModel, IBlogPostModel { -#if NET6 protected BlogPostBase(IPublishedContent content, IPublishedValueFallback publishedValueFallback) : base(content, publishedValueFallback) { } -#elif NET472 - protected BlogPostBase(IPublishedContent content) - : base(content) { } -#endif public DateTime PostDate => this.Value("postDate"); diff --git a/Gibe.Umbraco.Blog/Models/BlogSettings.cs b/Gibe.Umbraco.Blog/Models/BlogSettings.cs new file mode 100644 index 0000000..d3454d3 --- /dev/null +++ b/Gibe.Umbraco.Blog/Models/BlogSettings.cs @@ -0,0 +1,14 @@ +namespace Gibe.Umbraco.Blog.Models +{ + public class BlogSettings : IBlogSettings + { + public string IndexName { get; set; } = "ExternalIndex"; + + public string BlogPostDocumentTypeAlias { get; set; } = "blogPost"; + public string BlogSectionDocumentTypeAlias { get; set; } = "blogSection"; + + public string UserPickerPropertyEditorAlias { get; set; } = "Umbraco.UserPicker"; + + public string UserPickerName { get; set; } = "User Picker - All Users"; + } +} diff --git a/Gibe.Umbraco.Blog/Models/HardCodedBlogSettings.cs b/Gibe.Umbraco.Blog/Models/HardCodedBlogSettings.cs deleted file mode 100644 index f810e3d..0000000 --- a/Gibe.Umbraco.Blog/Models/HardCodedBlogSettings.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Gibe.Umbraco.Blog.Models; - -#if NET472 -using Gibe.Settings.Interfaces; - -namespace Gibe.Umbraco.Blog.Models -{ - public class HardCodedBlogSettings : IBlogSettings - { - private readonly ISettingsService _settingsService; - - public HardCodedBlogSettings(ISettingsService settingsService) - { - _settingsService = settingsService; - } - - public string IndexName => "ExternalIndex"; - - public string BlogPostDocumentTypeAlias => _settingsService.GetSetting("Gibe.Umbraco.Blog.BlogPostDocumentTypeAlias", "blogPost"); - public string BlogSectionDocumentTypeAlias => _settingsService.GetSetting("Gibe.Umbraco.Blog.BlogSectionDocumentTypeAlias", "blogSection"); - - public string UserPickerPropertyEditorAlias => _settingsService.GetSetting("Gibe.Umbraco.Blog.UserPickerPropertyEditorAlias", "Umbraco.UserPicker"); - - public string UserPickerName => _settingsService.GetSetting("Gibe.Umbraco.Blog.UserPickerName", "User Picker - All Users"); - } -} -#elif NET6 -public class HardCodedBlogSettings : IBlogSettings -{ - public string IndexName => "ExternalIndex"; - - public string BlogPostDocumentTypeAlias => "blogPost"; - public string BlogSectionDocumentTypeAlias => "blogSection"; - - public string UserPickerPropertyEditorAlias => "Umbraco.UserPicker"; - - public string UserPickerName => "User Picker - All Users"; -} -#endif diff --git a/Gibe.Umbraco.Blog/Models/IBlogPostModel.cs b/Gibe.Umbraco.Blog/Models/IBlogPostModel.cs index 754182f..90a0979 100644 --- a/Gibe.Umbraco.Blog/Models/IBlogPostModel.cs +++ b/Gibe.Umbraco.Blog/Models/IBlogPostModel.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -#if NET6 using Umbraco.Cms.Core.Models.PublishedContent; -#elif NET472 -using Umbraco.Core.Models.PublishedContent; -#endif namespace Gibe.Umbraco.Blog.Models { diff --git a/Gibe.Umbraco.Blog/Repositories/BlogContentRepository.cs b/Gibe.Umbraco.Blog/Repositories/BlogContentRepository.cs index 4edbf96..87a644c 100644 --- a/Gibe.Umbraco.Blog/Repositories/BlogContentRepository.cs +++ b/Gibe.Umbraco.Blog/Repositories/BlogContentRepository.cs @@ -1,12 +1,5 @@ -#if NET6 -using Umbraco.Cms.Core.Models.PublishedContent; +using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Cms.Core.Web; -#elif NET472 -using Umbraco.Core.Models.PublishedContent; -using Umbraco.Web; -#endif - - namespace Gibe.Umbraco.Blog.Repositories { diff --git a/Gibe.Umbraco.Blog/Repositories/IBlogContentRepository.cs b/Gibe.Umbraco.Blog/Repositories/IBlogContentRepository.cs index 84f21b7..801ddd7 100644 --- a/Gibe.Umbraco.Blog/Repositories/IBlogContentRepository.cs +++ b/Gibe.Umbraco.Blog/Repositories/IBlogContentRepository.cs @@ -1,8 +1,4 @@ -#if NET6 -using Umbraco.Cms.Core.Models.PublishedContent; -#elif NET472 -using Umbraco.Core.Models.PublishedContent; -#endif +using Umbraco.Cms.Core.Models.PublishedContent; namespace Gibe.Umbraco.Blog.Repositories { diff --git a/Gibe.Umbraco.Blog/Service.cs b/Gibe.Umbraco.Blog/Service.cs index a4319f3..0760fec 100644 --- a/Gibe.Umbraco.Blog/Service.cs +++ b/Gibe.Umbraco.Blog/Service.cs @@ -12,7 +12,6 @@ using Microsoft.Extensions.Options; using Umbraco.Cms.Core.Composing; using Umbraco.Cms.Core.DependencyInjection; -using Umbraco.Cms.Core.Logging.Viewer; using Umbraco.Extensions; namespace Gibe.Umbraco.Blog @@ -21,9 +20,12 @@ public static class NetCoreServicesExtensions { public static void AddGibeBlog(this IServiceCollection services) where T : class, IBlogPostModel { + services.AddOptions() + .BindConfiguration("Gibe:Umbraco:Blog") + .ValidateOnStart(); + services.AddGibePager(); services.AddTransient(); - services.AddTransient(); services.AddTransient, BlogService>(); services.AddTransient, UnpagedBlogService>(); services.AddTransient, BlogPostMapper>(); diff --git a/Gibe.Umbraco.Blog/Wrappers/ISearchIndex.cs b/Gibe.Umbraco.Blog/Wrappers/ISearchIndex.cs index 45cfedb..fd9b07f 100644 --- a/Gibe.Umbraco.Blog/Wrappers/ISearchIndex.cs +++ b/Gibe.Umbraco.Blog/Wrappers/ISearchIndex.cs @@ -28,7 +28,7 @@ public FakeSearchIndex(ISearchResults searchResults, public IQuery CreateSearchQuery() { return GetIndex() - .GetSearcher() + .Searcher .CreateQuery(); } diff --git a/Gibe.Umbraco.Blog/Wrappers/NewsIndex.cs b/Gibe.Umbraco.Blog/Wrappers/NewsIndex.cs index 730441b..0e4a196 100644 --- a/Gibe.Umbraco.Blog/Wrappers/NewsIndex.cs +++ b/Gibe.Umbraco.Blog/Wrappers/NewsIndex.cs @@ -2,25 +2,26 @@ using Examine.Search; using Gibe.Umbraco.Blog.Exceptions; using Gibe.Umbraco.Blog.Models; +using Microsoft.Extensions.Options; namespace Gibe.Umbraco.Blog.Wrappers { public class NewsIndex : ISearchIndex { private readonly IExamineManager _examineManager; - private readonly IBlogSettings _blogSettings; + private readonly BlogSettings _blogSettings; public NewsIndex(IExamineManager examineManager, - IBlogSettings blogSettings) + IOptions blogSettings) { _examineManager = examineManager; - _blogSettings = blogSettings; + _blogSettings = blogSettings.Value; } public IQuery CreateSearchQuery() { return GetIndex() - .GetSearcher() + .Searcher .CreateQuery(); } diff --git a/VERSION.txt b/VERSION.txt index 95c4e8d..70045d3 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -10.0.0 \ No newline at end of file +13.0.0 \ No newline at end of file