Dont return nullable lists

This commit is contained in:
Nikolaj Geisle
2022-04-20 08:42:06 +02:00
parent 927d687192
commit 0d600d6677
3 changed files with 8 additions and 8 deletions

View File

@@ -7,7 +7,7 @@ namespace Umbraco.Cms.Core.Persistence.Repositories
{
IDomain? GetByName(string domainName);
bool Exists(string domainName);
IEnumerable<IDomain>? GetAll(bool includeWildcards);
IEnumerable<IDomain>? GetAssignedDomains(int contentId, bool includeWildcards);
IEnumerable<IDomain> GetAll(bool includeWildcards);
IEnumerable<IDomain> GetAssignedDomains(int contentId, bool includeWildcards);
}
}

View File

@@ -65,7 +65,7 @@ namespace Umbraco.Cms.Core.Services
}
}
public IEnumerable<IDomain>? GetAll(bool includeWildcards)
public IEnumerable<IDomain> GetAll(bool includeWildcards)
{
using (var scope = ScopeProvider.CreateScope(autoComplete: true))
{
@@ -73,7 +73,7 @@ namespace Umbraco.Cms.Core.Services
}
}
public IEnumerable<IDomain>? GetAssignedDomains(int contentId, bool includeWildcards)
public IEnumerable<IDomain> GetAssignedDomains(int contentId, bool includeWildcards)
{
using (var scope = ScopeProvider.CreateScope(autoComplete: true))
{

View File

@@ -162,14 +162,14 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
return GetMany()?.Any(x => x.DomainName.InvariantEquals(domainName)) ?? false;
}
public IEnumerable<IDomain>? GetAll(bool includeWildcards)
public IEnumerable<IDomain> GetAll(bool includeWildcards)
{
return GetMany()?.Where(x => includeWildcards || x.IsWildcard == false);
return GetMany().Where(x => includeWildcards || x.IsWildcard == false);
}
public IEnumerable<IDomain>? GetAssignedDomains(int contentId, bool includeWildcards)
public IEnumerable<IDomain> GetAssignedDomains(int contentId, bool includeWildcards)
{
return GetMany()?
return GetMany()
.Where(x => x.RootContentId == contentId)
.Where(x => includeWildcards || x.IsWildcard == false);
}