* Update gitignore * Move csproj * Update project references * Update solutions * Update build scripts * Tests used to share editorconfig with projects in src * Fix broken tests. * Stop copying around .editorconfig merged root one with linting * csharp_style_expression_bodied -> suggestion * Move StyleCop rulesets to matching directories and update shared build properties * Remove legacy build files, update NuGet.cofig and solution files * Restore myget source * Clean up .gitignore * Update .gitignore * Move new test classes to tests after merge * Gitignore + nuget config * Move new test Co-authored-by: Ronald Barendse <ronald@barend.se>
38 lines
1.6 KiB
C#
38 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Umbraco.Cms.Core.PublishedCache;
|
|
using Umbraco.Cms.Core.Routing;
|
|
using Umbraco.Cms.Core.Services;
|
|
using Umbraco.Extensions;
|
|
|
|
namespace Umbraco.Tests.LegacyXmlPublishedCache
|
|
{
|
|
internal class DomainCache : IDomainCache
|
|
{
|
|
private readonly IDomainService _domainService;
|
|
|
|
public DomainCache(IDomainService domainService, IDefaultCultureAccessor defaultCultureAccessor)
|
|
{
|
|
_domainService = domainService;
|
|
DefaultCulture = defaultCultureAccessor.DefaultCulture;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<Domain> GetAll(bool includeWildcards) => _domainService.GetAll(includeWildcards)
|
|
.Where(x => x.RootContentId.HasValue && x.LanguageIsoCode.IsNullOrWhiteSpace() == false)
|
|
.Select(x => new Domain(x.Id, x.DomainName, x.RootContentId.Value, x.LanguageIsoCode, x.IsWildcard));
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<Domain> GetAssigned(int documentId, bool includeWildcards = false) => _domainService.GetAssignedDomains(documentId, includeWildcards)
|
|
.Where(x => x.RootContentId.HasValue && x.LanguageIsoCode.IsNullOrWhiteSpace() == false)
|
|
.Select(x => new Domain(x.Id, x.DomainName, x.RootContentId.Value, x.LanguageIsoCode, x.IsWildcard));
|
|
|
|
/// <inheritdoc />
|
|
public bool HasAssigned(int documentId, bool includeWildcards = false)
|
|
=> documentId > 0 && GetAssigned(documentId, includeWildcards).Any();
|
|
|
|
/// <inheritdoc />
|
|
public string DefaultCulture { get; }
|
|
}
|
|
}
|